Boost logo

Boost Users :

From: KSpam (keesling_spam_at_[hidden])
Date: 2007-06-11 20:01:04


On Monday 11 June 2007 15:36, Meryl Silverburgh wrote:
> If I create a thread using boost::thread() library?
>
> boost::thread thrd( &DoWork ) );
>
> How can I kill "thrd" later on?

The technique I typically use involves a "Control" object that is shared
between the main thread and the thread function. The main thread can call
the stop method of the control object, and the thread function periodically
checks whether the stop command was issued.

I have attached an example of this technique. This should be portable for any
platform that can compile the Boost.Thread library.

Justin




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