fixed legacy mac os timer interrupt handling

This commit is contained in:
hyunghwan.chung 2016-05-19 11:22:02 +00:00
parent c39aa957ad
commit 9f4433cf98

View File

@ -407,13 +407,17 @@ static void timer_intr_handler (void)
#elif defined(macintosh) #elif defined(macintosh)
static TMTask g_tmtask; static TMTask g_tmtask;
static ProcessSerialNumber g_psn;
#define TMTASK_DELAY 50 /* milliseconds if positive, microseconds(after negation) if negative */
static pascal void timer_intr_handler (TMTask* task) static pascal void timer_intr_handler (TMTask* task)
{ {
if (g_stix) stix_switchprocess (g_stix); if (g_stix) stix_switchprocess (g_stix);
WakeUpProcess (&g_psn);
PrimeTime ((QElem*)&g_tmtask, TMTASK_DELAY);
} }
#else #else
static void arrange_process_switching (int sig) static void arrange_process_switching (int sig)
{ {
@ -430,15 +434,12 @@ static void setup_tick (void)
#elif defined(macintosh) #elif defined(macintosh)
long delay = 50; GetCurrentProcess (&g_psn);
memset (&g_tmtask, 0, STIX_SIZEOF(g_tmtask)); memset (&g_tmtask, 0, STIX_SIZEOF(g_tmtask));
g_tmtask.tmAddr = NewTimerProc (timer_intr_handler); g_tmtask.tmAddr = NewTimerProc (timer_intr_handler);
InsXTime ((QElem*)&g_tmtask); InsXTime ((QElem*)&g_tmtask);
/* if delay is positive, it's in milliseconds. PrimeTime ((QElem*)&g_tmtask, TMTASK_DELAY);
* if it's negative, it's in negated microsecond */
PrimeTime ((QElem*)&g_tmtask, delay);
#elif defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL) #elif defined(HAVE_SETITIMER) && defined(SIGVTALRM) && defined(ITIMER_VIRTUAL)
struct itimerval itv; struct itimerval itv;