Luca Bacci <[email protected]> wrote:

>> FYI, there is the exact same race condition in spinlock.c as well. TBH, this 
>> was one of my concerns with those changes.
>
> Ah, indeed! We should audit other kind of objects, too. For example, 
> pthread_cond_destroy can run concurrently with pthread_cond_signal / 
> pthread_cond_broadcast after they notify waiting thread(s). 
> Pthread_barrier_wait() too, after waking waiting threads.
>
> I can look at that in the next days, but if someone beats me to it
>
>> If you look at other files, e.g. barrier.c, you'll see that they use global 
>> `spinlock_t` when accessing _any_ object. IMO, this is unacceptable as this 
>> slows down the entire implementation.
>
> Yup, agree. We should get rid of all those global mutexes.

If you don't mind, I would like to take some time and clean up those files 
first, in a similar way I did to spinlock.c and mutex.c. After that, we could 
think how we can improve them. I remember you considered updating 
`pthread_cond_t` implementation to use `WaitOnAddress` and friends when 
available; this would be one of such improvements.

Aside for small fixes and improvements here and there, the library mostly was 
not touch for the last decade... So, there is a lot of stuff to look into.

- Kirill Makurin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to