简体   繁体   中英

boost asio, post() to main thread?

I am using boost::asio as a general async backend.

I have multiple threads runing one io_context

But I encounter certain operations that are binded to specific thread. For example, imshow of opencv must be called from main thread.

What is the best way to post to main thread, or any specific thread in general? (without busy loop)

You can't do it through asio. You can use message queue you read in main thread (like Windows messages) or other specific thread.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM