Subj : Re: thread suspend using pthreads? To : comp.programming.threads From : David Hopwood Date : Sat Sep 03 2005 04:31 am Joe Seigh wrote: > Yaytay wrote: > >> On Windows it is reasonably common practice to start a thread >> suspended, then resume it. This does not introduce race conditions. >> So I'd argue that it is suspend that is risky, not resume. > > This is a way of dealing with the creation of threads being expensive > so you create them before you actually need them. There are lots > of ways of dealing with that. One is to use a condition variable or > semaphore that the created thread blocks on first thing. You unblock > it when you want the thread to actually start. Thread pools are a > generalization of this mechanism. You prestart a bunch of threads > and start them when you want to. You also can reuse the threads in > this case. It always amazes me, the extent to which people seem resigned to working around the same design flaws again and again in applications, rather than fixing (or even complaining about!) the underlying problems in the infrastructure. -- David Hopwood .