|
Boost Users : |
From: Mark Sizer (yg-boost-users_at_[hidden])
Date: 2003-06-05 19:23:47
BTW: Is there enough of a penalty to creating threads that a thread pool
should be used rather than creating them on-demand? I'm curious because
I'm using a pool pulling from a work queue.
- Mark
P.S. I realize "enough" is a bit vague.
Mark Sizer wrote:
> What is "the right thing"?
>
> You don't HAVE to join(). The creating thread will just keep going if
> you don't. If you join, it waits.
>
> If you're passing ownership (e.g. delete responsibility) across thread
> boundaries, you have to be careful, but that doesn't have much to do
> with join().
>
> After starting the thread, you can use a condtional in the creator to
> wait for the thread to "get going" and accept ownership, sort of a
> "started()" rather than an "ended()", like join(). Or you can flip it
> around and have the started thread wait on the conditional whilst the
> creator thread continues to use what will eventually be given to the thread.
>
> Is that at all helpful?
>
> - Mark
>
> dick.bridges_at_[hidden] wrote:
>
>
>>I need to spawn worker threads that simply perform a task and exit. All
>>the examples I can find seem to use join() to cleanup the thread resources
>>from another thread. Isn't there some way to declare worker threads so
>>that they "do the right thing" as they exit the thread function?
>>
>>TIA
>>
>>
>>
>>Info: <http://www.boost.org>
>>Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
>>Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>>
>>
>>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>>
>>
>>
>>
>>
>
>
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
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