Boost logo

Boost Users :

Subject: Re: [Boost-users] Thread_group semantics
From: Kenneth Adam Miller (kennethadammiller_at_[hidden])
Date: 2014-01-13 19:26:15


Would it work better if it was threads.join_all() then ioServices.stop()?

On Mon, Jan 13, 2014 at 5:29 PM, Kenneth Adam Miller <
kennethadammiller_at_[hidden]> wrote:

> Ah ok. Thanks.
>
>
> On Mon, Jan 13, 2014 at 5:22 PM, Gavin Lambert <gavinl_at_[hidden]>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_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net