Eugene Zolenko wrote:
> Actually this code still has problems with multithreading. Following
> operation must be atomic: (if s_objectState == 0 then s_objectState =
> 1), and there is no way to guarantee that. 2 threads can enter segment
> [1]-[2] if one loses execution time between "switch (s_objectState)"
> and [1]. I'm not sure it is possible to make this thread-safe without
> actual lock. (might be possible in C++0x with new atomic<> stuff, but
> not yet)

Yes, even with "volatile" two threads can each create an object and one of 
them will be leaked, but that is acceptable (and already documented). The 
bug where an infinite loop can happen without "volatile" does need to be 
fixed. Thanks for pointing that out. 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to