Use lock_guard instead of explicit lock/unlock
This commit is contained in:
parent
3dd4ca7349
commit
7c51e2e34b
|
@ -262,9 +262,10 @@ EmuHandle* EmuHandle::CreateEmuHandle(EmuNtObject* ntObject) {
|
||||||
auto emuHandle = new EmuHandle(ntObject);
|
auto emuHandle = new EmuHandle(ntObject);
|
||||||
|
|
||||||
// Register EmuHandle
|
// Register EmuHandle
|
||||||
EmuHandleLookupLock.lock();
|
{
|
||||||
|
const std::lock_guard<std::mutex> scopedLock(EmuHandleLookupLock);
|
||||||
EmuHandleLookup.emplace(EmuHandleToHandle(emuHandle), emuHandle);
|
EmuHandleLookup.emplace(EmuHandleToHandle(emuHandle), emuHandle);
|
||||||
EmuHandleLookupLock.unlock();
|
}
|
||||||
|
|
||||||
return emuHandle;
|
return emuHandle;
|
||||||
}
|
}
|
||||||
|
@ -275,9 +276,8 @@ NTSTATUS EmuHandle::NtClose()
|
||||||
|
|
||||||
// Unregister the handle
|
// Unregister the handle
|
||||||
if (status == STATUS_SUCCESS) {
|
if (status == STATUS_SUCCESS) {
|
||||||
EmuHandleLookupLock.lock();
|
const std::lock_guard<std::mutex> scopedLock(EmuHandleLookupLock);
|
||||||
EmuHandleLookup.erase(EmuHandleToHandle(this));
|
EmuHandleLookup.erase(EmuHandleToHandle(this));
|
||||||
EmuHandleLookupLock.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
Loading…
Reference in New Issue