mirror of
https://github.com/fluencelabs/musl
synced 2025-06-01 17:11:53 +00:00
14 lines
281 B
C
14 lines
281 B
C
|
#include "pthread_impl.h"
|
||
|
|
||
|
int pthread_rwlock_wrlock(pthread_rwlock_t *rw)
|
||
|
{
|
||
|
int nr;
|
||
|
while (pthread_rwlock_trywrlock(rw)==EAGAIN) {
|
||
|
if ((nr=rw->__readers))
|
||
|
__wait(&rw->__readers, &rw->__waiters, nr, 0);
|
||
|
else
|
||
|
__wait(&rw->__wrlock, &rw->__waiters, 1, 0);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|