
And the lwm_win32 is just a spinlock. Isn't it something like (haven't looked at the code in a while) while (InterlockedExchange(...)) { Sleep(1); } ? Thanks Russell Martin Taylor wrote:
On 29 Jan 2004, at 14:28, Alexander Terekhov wrote:
Howard Hinnant wrote: [...]
Alexander, I have no doubt that you will see problems with this implementation, and I appreciate your comments.
Get rid of yield. With yield you basically have a spinlock, not a general purpose mutex. Think of a uniprocessor [under priority scheduling rules] with some higher priority thread contending for a lock currently owned by some lower priority thread.
I thought that the lightweight_mutex didn't have to be a general purpose mutex - in fact it explictily says just that in the comments of lightweight_mutex.hpp:
// boost::detail::lightweight_mutex meets a subset of the Mutex concept // requirements: http://www.boost.org/libs/thread/doc/mutex_concept.html#Mutex ... // * Not a general purpose mutex, use boost::mutex, CRITICAL_SECTION or // pthread_mutex instead. ... // The current implementation can use a pthread_mutex, a CRITICAL_SECTION, // or a platform-specific spinlock.
Regards, Martin
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost