Ah ok. Thanks.


On Mon, Jan 13, 2014 at 5:22 PM, Gavin Lambert <gavinl@compacsort.com> wrote:
On 14/01/2014 11:49, Quoth Kenneth Adam Miller:

Yeah it stores threads, not tasks, but isn't it true that you dispatch
jobs to the current thread group using ioService.post? Maybe my question
was wrong, because I went off using this recipe
http://stackoverflow.com/questions/19500404/how-to-create-a-thread-pool-using-boost-in-c

That's a bad recipe.  Don't write code like that.  (work and the threads are constructed in the wrong order, and stopping immediately after posting will not necessarily execute anything.)

Read the Boost.Asio docs (http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio.html) and examples instead.


But, to answer your immediate question: Boost.Asio's io_service acts like a queue.  It can store an unlimited (except by memory) number of tasks and they are executed in a loosely FIFO order ("loosely" as tasks may execute concurrently and thus apparently out of order when multiple worker threads are used).



_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users