2007-05-09 Jonathan Chambers <joncham@gmail.com>
authorJonathan Chambers <joncham@gmail.com>
Wed, 9 May 2007 18:21:37 +0000 (18:21 -0000)
committerJonathan Chambers <joncham@gmail.com>
Wed, 9 May 2007 18:21:37 +0000 (18:21 -0000)
* win32_threads.c: If SuspendThread fails, don't abort. Instead
remove thread from GC, as this only seems to happen when thread is
terminating.

svn path=/trunk/mono/; revision=77073

libgc/ChangeLog
libgc/win32_threads.c

index c1de02cb5c099534d760abc00ddad8b70dd5d1e3..70d44fe56e1087e459fe48b9889960c6b582c7bb 100644 (file)
@@ -1,3 +1,9 @@
+2007-05-09  Jonathan Chambers  <joncham@gmail.com>
+
+       * win32_threads.c: If SuspendThread fails, don't abort. Instead
+       remove thread from GC, as this only seems to happen when thread is
+       terminating.
+
 2007-03-29  Zoltan Varga  <vargaz@gmail.com>
 
        * autogen.sh: Applied patch from Priit Laes <amd@store20.com>. Fix the running
index 87944dc375ff986313a60288a9ca1eec8691f0dd..a9569c83f00e4badf914f06ef241abfab210fb42 100644 (file)
@@ -283,8 +283,15 @@ void GC_stop_world()
 #         endif
          continue;
        }
-       if (SuspendThread(thread_table[i].handle) == (DWORD)-1)
-         ABORT("SuspendThread failed");
+       if (SuspendThread(thread_table[i].handle) == (DWORD)-1) {
+          thread_table[i].stack_base = 0; /* prevent stack from being pushed */
+#         ifndef CYGWIN32
+            /* this breaks pthread_join on Cygwin, which is guaranteed to  */
+           /* only see user pthreads                                      */
+           thread_table[i].in_use = FALSE;
+           CloseHandle(thread_table[i].handle);
+#         endif
+       }
 #     endif
       thread_table[i].suspended = TRUE;
     }