From: Johannes Sixt Date: Fri, 08 Jan 2010 20:40:36 GMT Subject: Re: [PATCH 1/5] MSVC: Windows-native implementation for subset of Pthreads API Message-ID: <201001082140.36717.j6t@kdbg.org> In-Reply-To: <40aa078e1001080258n67e0711sf4733a99d512bf1@mail.gmail.com> On Freitag, 8. Januar 2010, Erik Faye-Lund wrote: > On Fri, Jan 8, 2010 at 4:32 AM, Dmitry Potapov wrote: > > AFAIK, Win32 API assumes that reading LONG is always atomic, so > > the critical section is not really necesary here, but you need > > to declare 'waiters' as 'volatile': > > "Simple reads and writes to properly-aligned 32-bit variables are > atomic operations." > http://msdn.microsoft.com/en-us/library/ms684122(VS.85).aspx > > In other words: Yes, you are right. Quite frankly, I do not want to stretch this statement to apply to the MinGW compiler. The code in question is not performance critical anyway. I'd prefer to leave it as is - it's undergone 2 months of testing already. Besides, IMHO, it is much more readable the way it is written. -- Hannes