Changeset: df980d777f70 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=df980d777f70
Modified Files:
        MonetDB/src/gdk/gdk_system.mx
Branch: Oct2010
Log Message:

It is allowed to call MT_exit_thread before any threads are created.
This fixes bug 2716.


diffs (32 lines):

diff -r 96f4abe4f2c6 -r df980d777f70 MonetDB/src/gdk/gdk_system.mx
--- a/MonetDB/src/gdk/gdk_system.mx     Tue Nov 09 09:59:00 2010 +0100
+++ b/MonetDB/src/gdk/gdk_system.mx     Tue Nov 09 11:40:21 2010 +0100
@@ -516,15 +516,19 @@
        DWORD t;
        struct winthread *w;
 
-       assert(winthread_cs_init);
-       t = GetCurrentThreadId();
-       EnterCriticalSection(&winthread_cs);
-       for (w = winthreads; w && w->tid != t; w = w->next)
-               ;
-       LeaveCriticalSection(&winthread_cs);
-       if (w->hdl == NULL)
-               rm_winthread(w);
-       ExitThread(s);
+       if (winthread_cs_init) {
+               t = GetCurrentThreadId();
+               EnterCriticalSection(&winthread_cs);
+               for (w = winthreads; w && w->tid != t; w = w->next)
+                       ;
+               LeaveCriticalSection(&winthread_cs);
+               if (w->hdl == NULL)
+                       rm_winthread(w);
+               ExitThread(s);
+       } else {
+               /* no threads started yet, so this is a global exit */
+               MT_global_exit(s);
+       }
 }
 
 int
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to