projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
implement pthread_rwlockattr_* (essentially no-ops)
[oweals/musl.git]
/
src
/
thread
/
pthread_rwlock_trywrlock.c
1
#include "pthread_impl.h"
2
3
int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
4
{
5
if (a_xchg(&rw->_rw_wrlock, 1))
6
return EAGAIN;
7
if (rw->_rw_readers) {
8
a_store(&rw->_rw_wrlock, 0);
9
return EAGAIN;
10
}
11
rw->_rw_owner = pthread_self()->tid;
12
return 0;
13
}