2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #408 from Subv/mutex

Mutex: Add the calling thread to the waiting list when needed
This commit is contained in:
bunnei 2015-01-04 22:55:53 -05:00
commit 96e6b2aa50

View file

@ -168,9 +168,9 @@ Handle CreateMutex(bool initial_locked, const std::string& name) {
ResultVal<bool> Mutex::WaitSynchronization() { ResultVal<bool> Mutex::WaitSynchronization() {
bool wait = locked; bool wait = locked;
if (locked) { if (locked) {
waiting_threads.push_back(GetCurrentThreadHandle());
Kernel::WaitCurrentThread(WAITTYPE_MUTEX, GetHandle()); Kernel::WaitCurrentThread(WAITTYPE_MUTEX, GetHandle());
} } else {
else {
// Lock the mutex when the first thread accesses it // Lock the mutex when the first thread accesses it
locked = true; locked = true;
MutexAcquireLock(this); MutexAcquireLock(this);