diff options
author | Keith Packard <keithp@keithp.com> | 2016-06-05 12:32:19 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-06-07 16:32:15 -0700 |
commit | 8174daa6bd3f0c792425a5ebef63a6a9ce7d00a4 (patch) | |
tree | 3bb8246a6a71b12764a28315e26358d45607dbf3 /os | |
parent | 88e981e7088198fabea6c322c58f371d91578b6a (diff) |
os: Do timers under input lock, not blocked signals
Timer processing can happen on either the main thread or the input
thread. As a result, it must be done under the input lock.
Signals are unrelated to timers now that SIGIO isn't used for input
processing, so stop blocking signals while processing timers.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'os')
-rw-r--r-- | os/WaitFor.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/os/WaitFor.c b/os/WaitFor.c index e839d6178..b82f82627 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -398,7 +398,7 @@ CheckAllTimers(void) OsTimerPtr timer; CARD32 now; - OsBlockSignals(); + input_lock(); start: now = GetTimeInMillis(); @@ -408,7 +408,7 @@ CheckAllTimers(void) goto start; } } - OsReleaseSignals(); + input_unlock(); } static void @@ -416,10 +416,10 @@ DoTimer(OsTimerPtr timer, CARD32 now, volatile OsTimerPtr *prev) { CARD32 newTime; - OsBlockSignals(); + input_lock(); *prev = timer->next; timer->next = NULL; - OsReleaseSignals(); + input_unlock(); newTime = (*timer->callback) (timer, now, timer->arg); if (newTime) @@ -439,7 +439,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis, return NULL; } else { - OsBlockSignals(); + input_lock(); for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { *prev = timer->next; @@ -448,7 +448,7 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis, break; } } - OsReleaseSignals(); + input_unlock(); } if (!millis) return timer; @@ -468,13 +468,13 @@ TimerSet(OsTimerPtr timer, int flags, CARD32 millis, if (!millis) return timer; } - OsBlockSignals(); + input_lock(); for (prev = &timers; *prev && (int) ((*prev)->expires - millis) <= 0; prev = &(*prev)->next); timer->next = *prev; *prev = timer; - OsReleaseSignals(); + input_unlock(); return timer; } @@ -484,7 +484,7 @@ TimerForce(OsTimerPtr timer) int rc = FALSE; volatile OsTimerPtr *prev; - OsBlockSignals(); + input_lock(); for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { DoTimer(timer, GetTimeInMillis(), prev); @@ -492,7 +492,7 @@ TimerForce(OsTimerPtr timer) break; } } - OsReleaseSignals(); + input_unlock(); return rc; } @@ -503,14 +503,14 @@ TimerCancel(OsTimerPtr timer) if (!timer) return; - OsBlockSignals(); + input_lock(); for (prev = &timers; *prev; prev = &(*prev)->next) { if (*prev == timer) { *prev = timer->next; break; } } - OsReleaseSignals(); + input_unlock(); } void @@ -528,10 +528,10 @@ TimerCheck(void) CARD32 now = GetTimeInMillis(); if (timers && (int) (timers->expires - now) <= 0) { - OsBlockSignals(); + input_lock(); while (timers && (int) (timers->expires - now) <= 0) DoTimer(timers, now, &timers); - OsReleaseSignals(); + input_unlock(); } } |