diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-01-14 14:59:27 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-01-14 14:59:27 +0000 |
commit | 5aa08409b1a78a892f2161506be869d4c8761d6e (patch) | |
tree | b3300ef6b5c6cd5dcb3e7c346dbdf91d37dd2f24 /lib/common/Timer.cpp | |
parent | f77d62515cd49ac50d16f0a54f14f6086d4ff745 (diff) |
- Make sure timer is stopped before removing signal handler, otherwise
SIGALRM will kill us.
Diffstat (limited to 'lib/common/Timer.cpp')
-rw-r--r-- | lib/common/Timer.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/common/Timer.cpp b/lib/common/Timer.cpp index de01f9f0..dcfe2ce2 100644 --- a/lib/common/Timer.cpp +++ b/lib/common/Timer.cpp @@ -56,9 +56,12 @@ void Timers::Cleanup() #if defined WIN32 && ! defined PLATFORM_CYGWIN // no support for signals at all - SetTimerHandler(NULL); FiniTimer(); + SetTimerHandler(NULL); #else + struct itimerval timeout; + memset(&timeout, 0, sizeof(timeout)); + ASSERT(::setitimer(ITIMER_REAL, &timeout, NULL) == 0); ASSERT(::signal(SIGALRM, NULL) == Timers::SignalHandler); #endif // WIN32 && !PLATFORM_CYGWIN @@ -203,11 +206,7 @@ void Timers::Reschedule() timeout.it_value.tv_usec = (int) (BoxTimeToMicroSeconds(timeToNextEvent) % MICRO_SEC_IN_SEC); -#ifdef PLATFORM_CYGWIN - if(::setitimer(ITIMER_REAL, &timeout, NULL) != 0) -#else if(::setitimer(ITIMER_REAL, &timeout, NULL) != 0) -#endif // PLATFORM_CYGWIN { TRACE0("WARNING: couldn't initialise timer\n"); THROW_EXCEPTION(CommonException, Internal) |