Re: [Boost-Users] Re: Newbie query: no "deamon" thread?

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
I was asking this question for someone else. Except for trivial programs, I always use one form of pool or another. Spend a lot of time reading "pattern" books. To tell the truth, I have no idea what the "real" cost of creating & killing threads is for the various OSs. I just treat it like small object memory allocation: if you don't have a custom allocator, try to avoid doing it. ;) Mark Sizer <yg-boost-users@m To: boost-users@yahoogroups.com .gmane.org> cc: Sent by: news Subject: [Boost-Users] Re: Newbie query: no "deamon" thread? <news@main.gmane. org> 06/05/2003 05:23 PM Please respond to Boost-Users 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: thread.
Is that at all helpful?
- Mark
dick.bridges@tais.com 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@yahoogroups.com>
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@yahoogroups.com>
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@yahoogroups.com> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
participants (1)
-
dick.bridges@tais.com