简体   繁体   中英

Boost Asio - async stack + poll

My application have a queue in a shared memory which is fed by another process. My main thread is looping over io_service.poll() to detect incoming event (mainly socket ones), and I would like to be notified through io_service.poll() when something is pushed into this queue.

Before migrating to boost.asio, I used to use the following mechanism: - extra thread polling onto the queue. - on new element, I write into a pipe to notify main thread. - main thread is looping over a select. On new element, pipe wakes up the select and I unstack my queue in a callback.

Is there more elegant ways to achieve similar behavior using boost.asio?

On windows, you will probably be able to use the Windows Object Handle service

Other than that I've seen some samples on integrating user-defined services here

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