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

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to