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

This commit is contained in:
RipleyTom authored and Ivan committed 2018-12-31 01:39:47 +03:00
1 parent 483ee5e488
commit 7ebd3bbcbf
1 file changed
+3 -1
+3 -1
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;