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

View file

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