From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-09-23 16:54:32


Jason Hise wrote:
> Can the yield function of boost::thread be used to immediately wake
> up a thread that is sleeping? I would like to use this to make sure
> that certain threads get the chance to exit before the process terminates,
> without join resulting in the whole program sleeping.

Join only blocks the current thread, not the whole program. If you want
thread X to exit before the process is terminated (via a return from main,
for instance), then joining X before returning from main or calling exit()
would be the appropriate way to accomplish that.

As for yield, it's almost entirely useless.