diff --git a/SheepShaver/src/Unix/sysdeps.h b/SheepShaver/src/Unix/sysdeps.h index d7e51b68..ead34d50 100644 --- a/SheepShaver/src/Unix/sysdeps.h +++ b/SheepShaver/src/Unix/sysdeps.h @@ -419,7 +419,7 @@ typedef struct timeval tm_time_t; #define C4X_FLOAT_FORMAT 4 // High-precision timing -#if defined(HAVE_PTHREADS) && defined(HAVE_CLOCK_NANOSLEEP) && 0 +#if defined(HAVE_PTHREADS) && defined(HAVE_CLOCK_NANOSLEEP) #define PRECISE_TIMING 1 #define PRECISE_TIMING_POSIX 1 #endif diff --git a/SheepShaver/src/timer.cpp b/SheepShaver/src/timer.cpp index 30a9e77e..526272e6 100644 --- a/SheepShaver/src/timer.cpp +++ b/SheepShaver/src/timer.cpp @@ -532,15 +532,15 @@ static void *timer_func(void *arg) tm_time_t system_time; timer_current_time(system_time); - pthread_mutex_lock(&wakeup_time_lock); if (timer_cmp_time(wakeup_time, system_time) < 0) { // Timer expired, trigger interrupt + pthread_mutex_lock(&wakeup_time_lock); wakeup_time = wakeup_time_max; + pthread_mutex_unlock(&wakeup_time_lock); SetInterruptFlag(INTFLAG_TIMER); TriggerInterrupt(); } - pthread_mutex_unlock(&wakeup_time_lock); } return NULL; }