Update Locking in extensions/globaltimers.c

This commit is contained in:
kamel5 2020-07-15 11:36:26 +02:00
parent 6f14ddae8a
commit 5402edd41b
1 changed files with 11 additions and 5 deletions

View File

@ -52,11 +52,14 @@ void cGlobalTimers::MarkLocalTimers(void) {
delete[] localTimer;
localTimer = NULL;
}
const cTimers* timers;
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
{
LOCK_TIMERS_READ;
const cTimers* timers = Timers;
timers = Timers;
}
#else
const cTimers* timers = &Timers;
timers = &Timers;
#endif
int numTimers = Size();
if (numTimers > 0) {
@ -78,14 +81,17 @@ void cGlobalTimers::MarkLocalTimers(void) {
}
void cGlobalTimers::SetLocalTimers(void) {
const cTimers* timers;
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
{
LOCK_TIMERS_READ;
const cTimers* timers = Timers;
timers = Timers;
}
#else
const cTimers* timers = &Timers;
timers = &Timers;
#endif
for (const cTimer *Timer = timers->First(); Timer; Timer = timers->Next(Timer)) {
if (Timer->HasFlags(tfActive))
if (Timer && Timer->HasFlags(tfActive))
Append(Timer);
}
}