Race conditions in critical.c?
Fawzi Mohamed
fmohamed at mac.com
Wed Oct 1 13:03:48 PDT 2008
On 2008-10-01 06:49:11 +0200, Sean Kelly <sean at invisibleduck.org> said:
> Sean Kelly wrote:
>> Bartosz Milewski wrote:
>>>
>>> If you think this is bizarre bordering on reckless I'm with you.
>>
>> Yup, it's completely useless given that POSIX only provides guarantees
>> for visibility, etc, for threads entering the *same* mutex. So one
>> couldn't even argue that this approach would work as some strange sort
>> of memory barrier.
>
> Oh, and I haven't fixed critical.c for the same reason. Given how they
> work, does *anyone* use this feature?
>
>
> Sean
I think that it should either throw an exception "unsupported" or be corrected.
it is possible to use it correctly if you have a function that is
called in parallel with only one critical section, or when the whole
function is synchronized.
I checked my code and I prefer explicit locks, so indeed I haven't
used, but both tango and phobos have some synchronized statements.
Fawzi
More information about the Digitalmars-d
mailing list