[cpp-threads] Asynchronous Execution Issues

Peter Dimov pdimov at mmltd.net
Sat Apr 25 12:45:07 BST 2009


Anthony Williams:
> You don't need a special type of future. If you want to do this, you  just 
> need to ensure that the future value is set as the last thing the  thread 
> does, after destroying the thread locals. How you achieve this  is up to 
> the library. For example, you could have a thread_local that  was created 
> first and destroyed last which set the future in its  destructor, or you 
> could use a platform-specific API to do the same.

I don't think that you can ensure that a specific thread_local is created 
first. Their order of construction is, as far as I can see, unspecified. 




More information about the cpp-threads mailing list