[AD] freeze on exit in windows |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: alleg-developers@xxxxxxxxxx
- Subject: [AD] freeze on exit in windows
- From: Elias Pschernig <allefant@xxxxxxxxxx>
- Date: Wed, 27 Apr 2005 17:18:37 +0200
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=ibQSpGg5UVTjPSRpEZdz6/Zl0L93i1PHX1TW9yIr1JHLSRQnO2G/5SsaURYivbMGd6o2NVKY4P5XikV6UG2BK8VclT0v3KgTy6plny+EbbnUov7ORalPPu0tSib2KiM6wbtb8k4I+/ljBKaO34LXQz2kr8ezzwgB8qZgXNACZ1g=
The old problem.. should be fixed by the attached patch. It does 2
things: Enables the timer mutexes, and replaces the INFINITE when
waiting for the thread with a loop. Why the loop is necessary, I don't
know. but the MSDN docs tell you to not use INFINITE when calling
CoInitialize (which we do), and their example uses a loop like this as
well.
(I also remember now, someone already pointed out that the
WaitForSingleObject line was the problem, but couldn't reproduce it
anymore when I started investigating.. and at that time, I couldn't
reproduce it myself, since HT was disabled in windows.)
Index: src/timer.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/timer.c,v
retrieving revision 1.22
diff -u -p -r1.22 timer.c
--- src/timer.c 24 Apr 2005 08:06:00 -0000 1.22
+++ src/timer.c 27 Apr 2005 14:42:15 -0000
@@ -26,10 +26,6 @@
/* Only tested with X11 so far. Can remove completely once it is tested with
* other platforms.
*/
-#ifndef ALLEGRO_WITH_XWINDOWS
-#undef ALLEGRO_MULTITHREADED /* FIXME */
-#endif
-
TIMER_DRIVER *timer_driver = NULL; /* the active driver */
Index: src/win/wtimer.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/win/wtimer.c,v
retrieving revision 1.17
diff -u -p -r1.17 wtimer.c
--- src/win/wtimer.c 14 Mar 2005 11:29:15 -0000 1.17
+++ src/win/wtimer.c 27 Apr 2005 14:42:15 -0000
@@ -245,7 +245,7 @@ static void tim_win32_exit(void)
SetEvent(timer_stop_event);
/* wait until thread has ended */
- WaitForSingleObject(timer_thread, INFINITE);
+ while (WaitForSingleObject(timer_thread, 100) == WAIT_TIMEOUT);
/* thread has ended, now we can release all resources */
CloseHandle(timer_stop_event);