Use lock guards for mutex locking
This commit is contained in:
@ -136,11 +136,10 @@ namespace Utils
|
||||
|
||||
Hook* Hook::Install(bool unprotect, bool keepUnportected)
|
||||
{
|
||||
Hook::StateMutex.lock();
|
||||
std::lock_guard<std::mutex> _(Hook::StateMutex);
|
||||
|
||||
if (!Hook::Initialized || Hook::Installed)
|
||||
{
|
||||
Hook::StateMutex.unlock();
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -159,8 +158,6 @@ namespace Utils
|
||||
|
||||
FlushInstructionCache(GetCurrentProcess(), Hook::Place, sizeof(Hook::Buffer));
|
||||
|
||||
Hook::StateMutex.unlock();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user