|
Threads-Devel : |
From: Tim Day (timday_at_[hidden])
Date: 2006-12-15 04:27:34
On Thu, 2006-12-14 at 16:55 -0500, Stuart A. Malone wrote:
> I've been working on a Mac OS X application that needs to suspendthe
> UI for a time while one or more worker threads perform a background
> computation for Sync Services. Once all the worker threads have
> completed, the UI thread can resume processing events. To resume the
> UI thread, exactly one of the worker threads needs to call
> QuitEventLoop() once all of the worker threads have completed.
Can't you just put all your worker threads into a boost::thread_group,
invoke join_all() on the main thread to wait for them all to finish,
then invoke the QuitEventLoop() from the main thread ?
(Sorry, I don't know anything about the Mac API, but in my experience
things that are inherently part of an apps serial flow of control are
best kept out of worker threads as it leads to unnecessary complication
trying to get one "special" thread to do something at the right time).
Tim