Fix sys_rwlock_runlock on waiting readers

readers can wait on the sleep queue if a writer lock has been blocked before it, in this case after runlock: writer should acquire the lock but the r's sleep queue is still not empty!
This commit is contained in:
eladash 2019-05-02 15:16:40 +03:00 committed by kd-11
parent 5141590729
commit ca08418dc1

View File

@ -246,7 +246,7 @@ error_code sys_rwlock_runlock(ppu_thread& ppu, u32 rw_lock_id)
{
if (const auto cpu = rwlock->schedule<ppu_thread>(rwlock->wq, rwlock->protocol))
{
rwlock->owner = cpu->id << 1 | !rwlock->wq.empty();
rwlock->owner = cpu->id << 1 | !rwlock->wq.empty() | !rwlock->rq.empty();
rwlock->awake(*cpu);
}