在 2026-5-26 04:10, Luca Bacci 写道:
My first version of patches used `pthread_spinlock_t` as a handle, which points to an 
internal structure, whose field is then used for spinning. LH commented on this 
implementation as "overcomplicated," and I clearly can see why, so I send few 
more potential implementations.

IMO we should go as LH suggested: storing the thread HANDLE (or perhaps the id) 
directly in pthread_spinlock_t (which is a typedef for intptr_t). And yes, we 
could add support for `PTHREAD_PROCESS_SHARED` by limiting used bits to 32.

That's just my 2 cents, happy to hear about other ideas :)


Thread handles are not technically unique, and there's no cheap way to obtain a real handle to a thread itself on Windows. Therefore it's much better to just store the thread ID in there.





--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

Reply via email to