[PATCH v2] Cygwin: pthread: Fix a race issue introduced by the commit 2c5433e5da82
Noel Grandin
noelgrandin@gmail.com
Thu May 30 10:28:16 GMT 2024
On 5/30/2024 11:15 AM, Bruno Haible wrote:
>> Still: Does ReleaseSRWLockExclusive notify other threads?
>
Of course? How else would a lock work, it must release other waiters?
It might not be a fair lock though, which is not a problem for this situation, which does not require fair locking.
> Functionally, the INIT_ONCE looks interesting. But, like Takashi Yano mentioned,
> how would you make it fit into a pthread_once_t that is defined as
> struct { pthread_mutex_t mutex; int state; }
> ?
Something like:
struct once {
union {
pthread_mutex_t old_mutex_field_for_size_compatibility;
SRWLOCK lock = SRWLOCK_INIT;
};
int state;
};
Regards, Noel Grandin
More information about the Cygwin
mailing list