Promise, future and thread on C++0x

Claudio La Rosa clros@tiscali.it
Thu Jul 7 14:31:00 GMT 2011




Jonathan Wakely-4 wrote:
> 
> 
>>> void myAsyncFun(promise<int>& intPromise)
>>> { ... }
> 
>>That works in GCC 4.6, but not in 4.5 due to a different bug in
>>std::thread which is fixed in GCC 4.6
> 
>>You can make it work in 4.5 by passing the promise to the thread by
>>reference instead of moving it:
> 
>>std::thread t(myAsyncFun, std::ref(intPromise));
> 
> 
Now it works fine! Thanks!
-- 
View this message in context: http://old.nabble.com/Promise%2C-future-and-thread-on-C%2B%2B0x-tp32008761p32013804.html
Sent from the gcc - libstdc++ mailing list archive at Nabble.com.



More information about the Libstdc++ mailing list