Boost logo

Boost Users :

From: William E. Kempf (wekempf_at_[hidden])
Date: 2003-02-05 16:49:57


> I've been using Boost for several months now, and I must say I've been
> very happy with it. I've primarily been using the threads and regex
> stuff from the library, and I have a question regarding the behavior of
> the thread_group.join_all method.
>
> In my current situation, I have a thread_group which launches several
> threads of execution for background servers, on an as-needed basis. If
> it becomes necessary to shutdown those background servers, I issue a
> join_all on the thread_group to wait for all activity to cease, then I
> can clear up the server instances themselves.
>
> If I issue a join_all from a thread and, while waiting for the
> join_all to exit, another thread creates a thread within my
> thread_group, what is expected?

Good question. Currently, the add_thread() or create_thread() will block
until the join_all() is finished, so the new thread will be added to an
empty thread_group. This is, however, probably not what's wanted, and I'm
working on this very issue.

> Will the join_all now wait for the
> original threads, as well as the newcomer, or will it only wait on the
> threads which were running at the time the join_all was called??

Only those present when join_all() was called (and worse, the addition of
the new thread blocks until the join_all() completes). I can fix the
blocking behavior, but the question then becomes which of the two
alternatives is found to be more appropriate: threads added during a
join_all() call are waited for as well, or only the threads currently in
the group are joined. I'm leaning towards the former.

-- 
William E. Kempf
wekempf_at_[hidden]

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