Merge pull request #256 from Subv/mutex
Kernel/Mutex: Properly lock the mutex when a thread enters it
This commit is contained in:
commit
3a75c8069e
3 changed files with 67 additions and 37 deletions
|
@ -14,6 +14,7 @@
|
|||
#include "core/hle/hle.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/kernel/mutex.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/mem_map.h"
|
||||
|
||||
|
@ -164,6 +165,9 @@ ResultCode StopThread(Handle handle, const char* reason) {
|
|||
Thread* thread = g_object_pool.Get<Thread>(handle);
|
||||
if (thread == nullptr) return InvalidHandle(ErrorModule::Kernel);
|
||||
|
||||
// Release all the mutexes that this thread holds
|
||||
ReleaseThreadMutexes(handle);
|
||||
|
||||
ChangeReadyState(thread, false);
|
||||
thread->status = THREADSTATUS_DORMANT;
|
||||
for (Handle waiting_handle : thread->waiting_threads) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue