rwlock trylock functions were wrongly returning EAGAIN instead of EBUSY
This commit is contained in:
parent
7e6be42a77
commit
e5dd18319b
2 changed files with 3 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rw)
|
||||||
a_dec(&rw->_rw_readers);
|
a_dec(&rw->_rw_readers);
|
||||||
if (rw->_rw_waiters && !rw->_rw_readers)
|
if (rw->_rw_waiters && !rw->_rw_readers)
|
||||||
__wake(&rw->_rw_readers, 1, 0);
|
__wake(&rw->_rw_readers, 1, 0);
|
||||||
return EAGAIN;
|
return EBUSY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
|
int pthread_rwlock_trywrlock(pthread_rwlock_t *rw)
|
||||||
{
|
{
|
||||||
if (a_xchg(&rw->_rw_wrlock, 1))
|
if (a_xchg(&rw->_rw_wrlock, 1))
|
||||||
return EAGAIN;
|
return EBUSY;
|
||||||
if (rw->_rw_readers) {
|
if (rw->_rw_readers) {
|
||||||
a_store(&rw->_rw_wrlock, 0);
|
a_store(&rw->_rw_wrlock, 0);
|
||||||
return EAGAIN;
|
return EBUSY;
|
||||||
}
|
}
|
||||||
rw->_rw_owner = pthread_self()->tid;
|
rw->_rw_owner = pthread_self()->tid;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue