Cleanup semaphore<> (sema.h) and mutex.h (shared_mutex)

Remove semaphore_lock and writer_lock classes, replace with std::lock_guard
Change semaphore<> interface to Lockable (+ exotic try_unlock method)
This commit is contained in:
Nekotekina 2018-09-03 22:28:33 +03:00
parent 5e556a87ff
commit ca5158a03e
50 changed files with 283 additions and 382 deletions

View file

@ -116,7 +116,7 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout)
if (result == CELL_EBUSY)
{
semaphore_lock lock(mutex.mutex);
std::lock_guard lock(mutex.mutex);
if (mutex.try_own(ppu, ppu.id))
{
@ -158,7 +158,7 @@ error_code sys_mutex_lock(ppu_thread& ppu, u32 mutex_id, u64 timeout)
if (passed >= timeout)
{
semaphore_lock lock(mutex->mutex);
std::lock_guard lock(mutex->mutex);
if (!mutex->unqueue(mutex->sq, &ppu))
{
@ -224,7 +224,7 @@ error_code sys_mutex_unlock(ppu_thread& ppu, u32 mutex_id)
if (mutex.ret == CELL_EBUSY)
{
semaphore_lock lock(mutex->mutex);
std::lock_guard lock(mutex->mutex);
if (auto cpu = mutex->reown<ppu_thread>())
{