Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Thread] Join not waiting?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-06-10 16:44:25


AMDG

James Auger wrote:
> <snip>
>
> class Example
> {
> public:
> Example();
> void run()
> {
> flag = 1;
> boost::thread _myThread(boost::bind(&Example::threadLoop, this));
> };
>

You are creating a new boost::thread which is completely unrelated to
the member _myThread. Try
_myThread = boost::thread(boost::bind(&Example::threadLoop, this));

> void terminate();
>
> private:
> void threadLoop();
>
> boost::thread _myThread;
> int flag;
> };
>

In Christ,
Steven Watanabe


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