LIU Hao wrote:

> 在 2026-9-23 12:25, Kirill Makurin 写道:
>> LIU Hao wrote:
>>
>>> As a robust mutex specifically handles the case where the owner thread no 
>>> longer exists, `mutex->Owner`
>>> might be recycled and reused for a different thread.
>>
>> There is another concern I have.
>>
>> We use `(DWORD)-1` as a special thread id value to indicate that a lock has 
>> no owner. Is possible that a
>> real thread will have this value as ID? Maybe we need to have an extra field 
>> which says that lock is
>> locked, in which case stored thread id value is always treated as a valid 
>> thread id.
>
> No, not at all: 
> https://devblogs.microsoft.com/oldnewthing/20080228-00/?p=23283/

Thanks, good to know. Otherwise, we had buggy mutexes this whole time, and 
since recently also spinlocks.

- Kirill Makurin

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

Reply via email to