mirror of
https://github.com/fluencelabs/musl
synced 2025-06-01 09:01:40 +00:00
14 lines
255 B
C
14 lines
255 B
C
|
#include "pthread_impl.h"
|
||
|
|
||
|
int pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
|
||
|
{
|
||
|
a_inc(&rw->__readers);
|
||
|
if (rw->__wrlock) {
|
||
|
a_dec(&rw->__readers);
|
||
|
if (rw->__waiters && !rw->__readers)
|
||
|
__wake(&rw->__readers, 1, 0);
|
||
|
return EAGAIN;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|