> 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.

That's fine with me. I have things laid out on paper, but still have to write 
the actual code and make tests. Oh, and I'm quite busy these days, so 
definitely need some more time. No rush! :-)

> 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.

Yeah, so true! Thanks for all your work on mingw-w64

Best Regards,
Luca
________________________________
Da: Kirill Makurin <[email protected]>
Inviato: sabato 17 ottobre 2026 14:43
A: [email protected] 
<[email protected]>
Oggetto: Re: [Mingw-w64-public] R: [PATCH 1/2] winpthreads/mutex: Avoid races 
between unlock and destroy

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

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

Reply via email to