4

Does anyone have an example illustrating the difference between boost::asio::io_service::poll and boost::asio::io_service::run?

More specifically what is the difference between calling join_all() on a thread_group executing run() and on another one executing poll()? Do both guarantee that all events have finished?

In the documentation available at http://www.boost.org/doc/libs/1_53_0/doc/html/boost_asio/reference/io_service/run/overload1.html, it is said:

The poll() function may also be used to dispatch ready handlers, but without blocking.

but I can't see what it clearly means.

FlashMcQueen
  • 635
  • 3
  • 13
  • 7
    Did you search for that? duplicate http://stackoverflow.com/questions/4705411/boostasio-io-service-run-vs-poll-or-how-do-i-integrate-boostasio-in-ma and here http://stackoverflow.com/questions/8727568/whats-the-difference-between-boostio-service-poll-one-and-run-one – Khalil Khalaf May 23 '16 at 13:56
  • @FirstStep did you vote to close as duplicate, or just wanted to slap a new user for not using the site correctly while you yourself didn't use it correctly. Help me in voting to close as duplicate please. –  May 26 '16 at 02:31
  • @Tech no I did not vote to close. Because while _Reviewing_ questions and making this website a better community, I had no time except to write that comment. Other experienced members like you, can do the vote thingy and upvote or downvote the OP. Thank you for caring – Khalil Khalaf May 26 '16 at 12:02
  • @FirstStep So you're saying it takes less time to look up a bunch of duplicates, then write a sentence to chastise the user, than it does to click a button and then click your confirmed reason? Also, leaving duplicate posts unflagged is helping make the site a better place? Thanks for caring. Oh and thanks for returning here, and still not clicking vote to close. –  May 26 '16 at 12:18
  • FlashMcQueen, welcome to SO. I apologize for the cold welcome to the site you got. As you can see, your question has been asked and answered before, so please look to those places for answers. Your question is going to be closed as a duplicate if and when people who are not brand new and should know better vote to close it. Please don't take this as a negative thing or let it discourage you from contributing in the future, this is normal and it happens even to seasoned members. There are tons of questions, duplicates happen daily. –  May 26 '16 at 12:20
  • @Tech Please move on and get over it – Khalil Khalaf May 26 '16 at 12:28
  • 1
    I was just looking for a sample of code showing an example but no worries. – FlashMcQueen May 26 '16 at 12:41
  • 2
    @FlashMcQueen You should look at the official docs, tons of samples. Basically poll will run one job in the service queue, run will run until all pending jobs are complete. If you use a `work` object, it'll never exit the run call until you explicitly tell the service to stop. –  May 26 '16 at 12:45
  • @FirstStep I'm over it. Since we're venturing into telling each other what to do with our time, thoughts and emotions, please use the site correctly and learn basic manners. –  May 26 '16 at 12:48

0 Answers0