mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
Mutex: Add the calling thread to the waiting list when needed
This will happen when the mutex is already owned by another thread. Should fix some issues with games being stuck due to waiting threads not being awoken.
This commit is contained in:
parent
b058ce6feb
commit
ea80363cc2
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue