Debugger: Fixed multi-threading issue that caused debugger to open up on its own while Lua scripts were running

This commit is contained in:
Souryo 2017-10-09 10:07:08 -04:00
parent ab91bef2b0
commit eb8f01b7e9
2 changed files with 3 additions and 7 deletions

View file

@ -574,8 +574,7 @@ bool Debugger::SleepUntilResume()
if(stepCount == 0 && !_stopFlag && _suspendCount == 0) {
//Break
auto lock = _breakLock.AcquireSafe();
_executionStopped = true;
if(_preventResume == 0) {
SoundMixer::StopAudio();
MessageManager::SendNotification(ConsoleNotificationType::CodeBreak);
@ -586,6 +585,7 @@ bool Debugger::SleepUntilResume()
}
}
_executionStopped = true;
while((stepCount == 0 && !_stopFlag && _suspendCount == 0) || _preventResume > 0) {
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(10));
stepCount = _stepCount.load();

View file

@ -34,11 +34,7 @@ void SimpleLock::Acquire()
bool SimpleLock::IsFree()
{
if(!_lock.test_and_set()) {
_lock.clear();
return true;
}
return false;
return _lockCount == 0;
}
void SimpleLock::WaitForRelease()