Boost logo

Boost Users :

Subject: Re: [Boost-users] postpone thread execution
From: Andrew Holden (aholden_at_[hidden])
Date: 2010-07-15 17:15:58

On Thursday, July 15, 2010 2:53 PM Bill Buklis wrote:
>> In boost::thread, when a thread is created, it starts execution at
>> instance itself. Instead of this, is it possible to postpone the
>> execution?
>> No. You can have the thread function block on a condition variable or
>> something straight away though. That way you can control when it
>> by setting the flag and notifying the condition variable.
> I know that this can be easily done in Windows with the
> flag. Can this be done in boost::thread? If not, I would consider this
a big
> limitation. Do other operating systems support this? Surely, Windows
> the only one. On that note does boost::thread support suspending and
> resuming thread execution? I haven't used boost::thread (only native
> calls), so I don't know.

An examination of
indicates that Posix threads (used by the UNIX family of operating
systems, including Linux and MacOS-X) does not support suspending
threads either at creation or later.

Also, Microsoft has found that the SuspendThread function is dangerous
If you desire the ability to suspend a thread, it is best to have it
wait on something.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at