
2 Jun
2007
2 Jun
'07
6:23 a.m.
Andy wrote:
If I use a static engine, I need to protect it with a mutex. This is not optimal because there is the overhead of locking and unlocking the mutex. Some people would rather have a static engine per thread using thread local storage. This still requires one to link with Boost.Thread. I created the uuid::create(Engine) function (great advice from this list) so that users could do whatever they want (static engine per thread, use thread local storage,...).
Perhaps you could write a CAS/lock-free random number generator. I have no idea how difficult that would be, I just recently stumbled over the CAS/lock-free threading technique myself. Thomas