12 Jun
2007
12 Jun
'07
12:01 a.m.
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