initial check-in, version 0.5.0
This commit is contained in:
commit
0b44a0315b
1021 changed files with 45711 additions and 0 deletions
17
src/thread/pthread_rwlock_unlock.c
Normal file
17
src/thread/pthread_rwlock_unlock.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue