Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Thread] Join not waiting?
From: James Auger (james.auger_at_[hidden])
Date: 2009-06-11 09:02:42


On Wed, Jun 10, 2009 at 4:44 PM, Steven Watanabe <watanabesj_at_[hidden]>wrote:

> 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));

Thanks! That was the problem. Though I had to bang my head against the wall
of boost syntax to figure out that it was looking for:

_myThread = boost::move(boost::thread(boost::bind(&Example::threadLoop,
this)));

As much as I like boost, sometimes I feel like programing with it is like
playing one of those text-based adventure games where the challenge isn't
solving the puzzles, it's guessing the syntax...

> void terminate();
>>
>> private:
>> void threadLoop();
>>
>> boost::thread _myThread;
>> int flag;
>> };
>>
>>
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

Thanks,
James



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