projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
report that posix_spawn is supported in unistd.h and sysconf
[musl]
/
src
/
thread
/
pthread_rwlock_trywrlock.c
diff --git
a/src/thread/pthread_rwlock_trywrlock.c
b/src/thread/pthread_rwlock_trywrlock.c
index
1bcf7c9
..
bb3d3a9
100644
(file)
--- a/
src/thread/pthread_rwlock_trywrlock.c
+++ b/
src/thread/pthread_rwlock_trywrlock.c
@@
-2,12
+2,6
@@
int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
{
int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
{
- if (a_xchg(&rw->_rw_wrlock, 1))
- return EAGAIN;
- if (rw->_rw_readers) {
- a_store(&rw->_rw_wrlock, 0);
- return EAGAIN;
- }
- rw->_rw_owner = pthread_self()->tid;
+ if (a_cas(&rw->_rw_lock, 0, 0x7fffffff)) return EBUSY;
return 0;
}
return 0;
}