mirror of https://git.musl-libc.org/git/musl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
374 B
17 lines
374 B
#include "pthread_impl.h"
|
|
|
|
int pthread_rwlock_unlock(pthread_rwlock_t *rw)
|
|
{
|
|
struct pthread *self = pthread_self();
|
|
if (rw->__owner == self->tid) {
|
|
rw->__owner = 0;
|
|
a_store(&rw->__wrlock, 0);
|
|
if (rw->__waiters)
|
|
__wake(&rw->__wrlock, -1, 0);
|
|
return 0;
|
|
}
|
|
a_dec(&rw->__readers);
|
|
if (rw->__waiters && !rw->__readers)
|
|
__wake(&rw->__readers, 1, 0);
|
|
return 0;
|
|
}
|
|
|