Well, I am a fool. I must have been too tired when I checked that. Gavin Howard On Tue, Mar 15, 2022, 13:51 Markus Wichmann wrote: > On Tue, Mar 15, 2022 at 12:55:38PM -0600, Gavin Howard wrote: > > I am pretty sure that this is the right place and that it is a bug in > > musl. > > Once more we find someone blaming the implementation for their own > mistake. From your repository: > > | y_Status > | y_strucon_rwlock_wrlock(y_strucon_rwlock* l) > | { > | y_ThreadData d = y_strucon_thread_os_get(); > | > | yc_assert(l != NULL, YC_ASSERT_NULL); > | yc_assert(d != NULL, YC_ASSERT_NULL); > | > | y_THREAD_TRYLOCK1(d); > | > | y_Status s = y_strucon_rwlock_os_rdlock(l); > | > | return s; > | } > > The mistake is in this function. See what the function is called and > what subfunction it calls? No wonder multiple threads can take the lock > simultaneously. > > Also, while reading I found a glaring mistake in y_THREAD_TRYUNLOCK1(), > which I shall leave as homework to the reader. > > Ciao, > Markus >