iconv: add euro symbol to GBK as single byte 0x80
[musl.git] / src / thread / pthread_rwlock_tryrdlock.c
blobc13bc9cc1979178d573639fa2a6fcfee5cc41cb4
1 #include "pthread_impl.h"
3 int __pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
5 int val, cnt;
6 do {
7 val = rw->_rw_lock;
8 cnt = val & 0x7fffffff;
9 if (cnt == 0x7fffffff) return EBUSY;
10 if (cnt == 0x7ffffffe) return EAGAIN;
11 } while (a_cas(&rw->_rw_lock, val, val+1) != val);
12 return 0;
15 weak_alias(__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock);