On 2024-01-24 03:55, Takashi Yano via Cygwin wrote: > Are there any code examples that use PTHREAD_MUTEX_INITIALIZER > with pthread_mutex_destroy()?
I don't think I've seen one. I think they are rare in the field, precisely because PTHREAD_MUTEX_INITIALIZER is mainly used in C code to "initialize and forget" global mutexes, so they are ready before the first thread is every created (and before main is even called). Nobody cares about destruction of global mutexes in an executable (not shared library). >> Use of the initializer is not restricted to static objects >> by any normative wording. > > It seems that I had read the older POSIX document. > > https://pubs.opengroup.org/onlinepubs/007904875/functions/pthread_mutex_destroy.html Aha! OK! Because I had a memory of there had been something about a static restriction. I took it for granted you were right about that, and was looking at that for other reasons. So, good, that is gone. It never made sense anyway. Pairing the initializer with the destructor call can be done in all situations now. -- 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