mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 19:28:43 +12:00
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:
parent
5e556a87ff
commit
ca5158a03e
50 changed files with 283 additions and 382 deletions
|
@ -46,7 +46,7 @@ error_code _sys_lwmutex_destroy(u32 lwmutex_id)
|
|||
|
||||
const auto mutex = idm::withdraw<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex) -> CellError
|
||||
{
|
||||
semaphore_lock lock(mutex.mutex);
|
||||
std::lock_guard lock(mutex.mutex);
|
||||
|
||||
if (!mutex.sq.empty())
|
||||
{
|
||||
|
@ -83,7 +83,7 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout)
|
|||
}
|
||||
}
|
||||
|
||||
semaphore_lock lock(mutex.mutex);
|
||||
std::lock_guard lock(mutex.mutex);
|
||||
|
||||
if (u32 value = mutex.signaled)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ error_code _sys_lwmutex_lock(ppu_thread& ppu, u32 lwmutex_id, u64 timeout)
|
|||
|
||||
if (passed >= timeout)
|
||||
{
|
||||
semaphore_lock lock(mutex->mutex);
|
||||
std::lock_guard lock(mutex->mutex);
|
||||
|
||||
if (!mutex->unqueue(mutex->sq, &ppu))
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ error_code _sys_lwmutex_unlock(ppu_thread& ppu, u32 lwmutex_id)
|
|||
|
||||
const auto mutex = idm::check<lv2_obj, lv2_lwmutex>(lwmutex_id, [&](lv2_lwmutex& mutex) -> cpu_thread*
|
||||
{
|
||||
semaphore_lock lock(mutex.mutex);
|
||||
std::lock_guard lock(mutex.mutex);
|
||||
|
||||
if (const auto cpu = mutex.schedule<ppu_thread>(mutex.sq, mutex.protocol))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue