re-enable vdso clock_gettime on arm (32-bit) with workaround
[musl] / src / thread / pthread_rwlock_trywrlock.c
index c029b87..64d9d31 100644 (file)
@@ -1,13 +1,9 @@
 #include "pthread_impl.h"
 
-int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
+int __pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
 {
-       if (a_xchg(&rw->__wrlock, 1))
-               return EAGAIN;
-       if (rw->__readers) {
-               a_store(&rw->__wrlock, 0);
-               return EAGAIN;
-       }
-       rw->__owner = pthread_self()->tid;
+       if (a_cas(&rw->_rw_lock, 0, 0x7fffffff)) return EBUSY;
        return 0;
 }
+
+weak_alias(__pthread_rwlock_trywrlock, pthread_rwlock_trywrlock);