Re: [PATCH 1/5] MSVC: Windows-native implementation for subset of Pthreads API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mittwoch, 13. Januar 2010, Dmitry Potapov wrote:
> On Tue, Jan 12, 2010 at 10:13:38PM +0100, Johannes Sixt wrote:
> > In particular, it doesn't say that it is atomic WRT reads such as we have
> >
> > here:
> > > >> +     /* we're done waiting, so make sure we decrease waiters count
> > > >> */ +     EnterCriticalSection(&cond->waiters_lock);
> > > >> +     --cond->waiters;
> > > >> +     LeaveCriticalSection(&cond->waiters_lock);
>
> and these lines should be replaced with
>
>   InterlockedDecrement(&cond->waiters)

Ah, yes, of course. I quoted the wrong section, sorry. By "atomic WRT reads" I 
meant this snippet:

>> +     EnterCriticalSection(&cond->waiters_lock);
>> +     have_waiters = cond->waiters > 0;
>> +     LeaveCriticalSection(&cond->waiters_lock);

Is there "InterlockedRead()"? I suppose no, but I would get confirmation that 
a simple memory mov instruction is atomic WRT Interlocked* functions.

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]