Fixes issues where the mutex is destroyed while an unlock is happening

This commit is contained in:
RipleyTom 2018-12-30 15:39:40 +01:00 committed by Ivan
parent 483ee5e488
commit 7ebd3bbcbf

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "Emu/Memory/vm.h"
#include "Emu/System.h"
#include "Emu/IdManager.h"
@ -80,6 +80,8 @@ error_code sys_mutex_destroy(u32 mutex_id)
const auto mutex = idm::withdraw<lv2_obj, lv2_mutex>(mutex_id, [](lv2_mutex& mutex) -> CellError
{
std::lock_guard lock(mutex.mutex);
if (mutex.owner || mutex.lock_count)
{
return CELL_EBUSY;