Re: [PATCH 1/5] MSVC: Windows-native implementation for subset of Pthreads API
On Thu, Jan 14, 2010 at 12:12 AM, Dmitry Potapov wrote:
Show 7 quoted lines
> On Wed, Jan 13, 2010 at 07:40:43PM +0100, Johannes Sixt wrote:
>> Is there "InterlockedRead()"? I suppose no, but I would get confirmation that
>> a simple memory mov instruction is atomic WRT Interlocked* functions.
>
> If I were writing Interlocked API, I would certainly add InterlockedRead()
> and InterlockedWrite() functions, but somehow Microsoft decided that these
> functions are redundant.
InterlockedWrite is spelt InterlockedExchange.
Show 5 quoted lines
> Finally, there is a paranoiac implementation of InterlockedRead(&foo):
>
> result = InterlockedAdd(&foo, 0)
>
> but, IMHO, it is pathetic...
Agreed. Another pathetic implementation:
result = InterlockedCompareExchange(&foo, 0, 0);
Peter Harris