libc: rwlock cleanup

Issue #3912
This commit is contained in:
Christian Prochaska 2020-10-13 13:31:31 +02:00 committed by Christian Helmuth
parent bf4afefaa1
commit 9cd38a6846

View File

@ -76,18 +76,16 @@ extern "C" {
if (_owner == nullptr) {
Mutex::Guard guard(_nbr_mutex);
_nbr--;
if (_nbr == 0) {
_owner = nullptr;
if (_nbr == 0)
_global_sem.up();
}
return 0;
};
}
if (_owner != Thread::myself()) {
error("Unlocking writer lock owned by other thread");
errno = EPERM;
return -1;
};
}
/* Write lock owned by us */
_owner = nullptr;