BACKENDS: Added debug output for race condition. Guarded by an #ifdef

This commit is contained in:
Eugene Sandulenko 2020-08-19 11:58:00 +02:00
parent ca178f0fd8
commit 75a4e622c2
2 changed files with 33 additions and 1 deletions

View File

@ -69,8 +69,15 @@ DefaultTimerManager::DefaultTimerManager() :
}
DefaultTimerManager::~DefaultTimerManager() {
#ifdef DIRECTORBUILDBOT
warning("~DefaultTimerManager");
#endif
Common::StackLock lock(_mutex);
#ifdef DIRECTORBUILDBOT
warning("~DefaultTimerManager: locked");
#endif
TimerSlot *slot = _head;
while (slot) {
TimerSlot *next = slot->next;
@ -78,10 +85,20 @@ DefaultTimerManager::~DefaultTimerManager() {
slot = next;
}
_head = 0;
#ifdef DIRECTORBUILDBOT
warning("~DefaultTimerManager: completed");
#endif
}
void DefaultTimerManager::handler() {
#ifdef DIRECTORBUILDBOT
warning("DefaultTimerManager::handler(): locking");
#endif
Common::StackLock lock(_mutex);
#ifdef DIRECTORBUILDBOT
warning("DefaultTimerManager::handler(): locked");
#endif
uint32 curTime = g_system->getMillis(true);

View File

@ -32,8 +32,16 @@
static volatile bool timerInstalled = false;
static Uint32 timer_handler(Uint32 interval, void *param) {
if (!timerInstalled)
if (!timerInstalled) {
#ifdef DIRECTORBUILDBOT
warning("timer_handler: timer is not installed");
#endif
return interval;
}
#ifdef DIRECTORBUILDBOT
warning("timer_handler: called");
#endif
((DefaultTimerManager *)param)->handler();
return interval;
@ -52,9 +60,16 @@ SdlTimerManager::SdlTimerManager() {
}
SdlTimerManager::~SdlTimerManager() {
#ifdef DIRECTORBUILDBOT
warning("~SdlTimerManager");
#endif
timerInstalled = false;
// Removes the timer callback
SDL_RemoveTimer(_timerID);
#ifdef DIRECTORBUILDBOT
warning("~SdlTimerManager: SDL timer removed");
#endif
}
#endif