drivers/timers_win32/timers_win32.c
changeset 605 f91ee161b3a1
parent 591 513f5ec8b628
child 606 15a175f6305d
--- a/drivers/timers_win32/timers_win32.c	Mon Oct 05 11:35:40 2009 +0200
+++ b/drivers/timers_win32/timers_win32.c	Thu Oct 08 17:21:15 2009 +0200
@@ -76,10 +76,7 @@
 
 int TimerThreadLoop(void)
 {
-	EnterMutex();
-	// At first, TimeDispatch will call init_callback.
-	SetAlarm(NULL, 0, init_callback, 0, 0);
-	LeaveMutex();
+
 
 	while(!stop_timer)
 	{
@@ -134,6 +131,10 @@
 	unsigned long timer_thread_id;
 	stop_timer = 0;
 	init_callback = _init_callback;
+	EnterMutex();
+		// At first, TimeDispatch will call init_callback.
+	SetAlarm(NULL, 0, init_callback, 0, 0);
+	LeaveMutex();
 	timer_thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TimerThreadLoop, NULL, 0, &timer_thread_id);
 }