summaryrefslogtreecommitdiff
path: root/src/thread/pthread_rwlock_trywrlock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/thread/pthread_rwlock_trywrlock.c')
-rw-r--r--src/thread/pthread_rwlock_trywrlock.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/thread/pthread_rwlock_trywrlock.c b/src/thread/pthread_rwlock_trywrlock.c
index 202e256a..bb3d3a99 100644
--- 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)
{
- if (a_xchg(&rw->_rw_wrlock, 1))
- return EBUSY;
- if (rw->_rw_readers) {
- a_store(&rw->_rw_wrlock, 0);
- return EBUSY;
- }
- rw->_rw_owner = pthread_self()->tid;
+ if (a_cas(&rw->_rw_lock, 0, 0x7fffffff)) return EBUSY;
return 0;
}