• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "pthread_impl.h"
2 
3 #ifdef ENABLE_HWASAN
4 __attribute__((no_sanitize("hwaddress")))
5 #endif
__pthread_rwlock_tryrdlock(pthread_rwlock_t * rw)6 int __pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
7 {
8 	int val, cnt;
9 	do {
10 		val = rw->_rw_lock;
11 		cnt = val & 0x7fffffff;
12 		if (cnt == 0x7fffffff) return EBUSY;
13 		if (cnt == 0x7ffffffe) return EAGAIN;
14 	} while (a_cas(&rw->_rw_lock, val, val+1) != val);
15 	return 0;
16 }
17 
18 weak_alias(__pthread_rwlock_tryrdlock, pthread_rwlock_tryrdlock);
19