]> granicus.if.org Git - gc/commitdiff
2010-10-09 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Sat, 9 Oct 2010 06:05:29 +0000 (06:05 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:55 +0000 (21:06 +0400)
* darwin_stop_world.c (GC_mach_thread): Move from
darwin_stop_world.h.
* include/private/darwin_stop_world.h (GC_mach_thread): Remove.
* win32_threads.c (GC_start_world): Define "thread_id" local
variable only if GC_ASSERTIONS; decide whether to resume a thread
based on its "suspended" field value; assert that suspended thread
stack_base is non-zero and the thread is not our one.

ChangeLog
darwin_stop_world.c
include/private/darwin_stop_world.h
win32_threads.c

index 1a13e235c19267d6e76de91755471cc722e24f86..95836fad1b3e1fac6cc1db52a4791d90ae19fee1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-09  Ivan Maidanski <ivmai@mail.ru>
+
+       * darwin_stop_world.c (GC_mach_thread): Move from
+       darwin_stop_world.h.
+       * include/private/darwin_stop_world.h (GC_mach_thread): Remove.
+       * win32_threads.c (GC_start_world): Define "thread_id" local
+       variable only if GC_ASSERTIONS; decide whether to resume a thread
+       based on its "suspended" field value; assert that suspended thread
+       stack_base is non-zero and the thread is not our one.
+
 2010-10-08  Ivan Maidanski <ivmai@mail.ru>
 
        * darwin_stop_world.c (GC_thread_resume): New inline function
index 7ba01335cde68db7db768acddaceb7e0701cd1b9..0124dc7bed22fdb9c748680772500860f0a9b16f 100644 (file)
@@ -304,6 +304,12 @@ STATIC GC_bool GC_use_mach_handler_thread = FALSE;
 #ifndef GC_MAX_MACH_THREADS
 # define GC_MAX_MACH_THREADS THREAD_TABLE_SZ
 #endif
+
+struct GC_mach_thread {
+  thread_act_t thread;
+  GC_bool already_suspended;
+};
+
 static struct GC_mach_thread GC_mach_threads[GC_MAX_MACH_THREADS];
 STATIC int GC_mach_threads_count = 0;
 /* FIXME: it is better to implement GC_mach_threads as a hash set.  */
index f4808697dbebdb7140a57f02dfee2c9a19f4bab6..787c357d1ddbb89aa48e78db88b44dd3a3afb3c1 100644 (file)
@@ -30,9 +30,4 @@ struct thread_stop_info {
   ptr_t stack_ptr; /* Valid only when stopped.  */
 };
 
-struct GC_mach_thread {
-  thread_act_t thread;
-  GC_bool already_suspended;
-};
-
 #endif
index 894e10fd939377caaae79906a3ebbbcec72d3eb8..05c7c565dad36e7fe0737498f861f0e5fedf91eb 100644 (file)
@@ -1067,7 +1067,9 @@ GC_INNER void GC_stop_world(void)
 
 GC_INNER void GC_start_world(void)
 {
-  DWORD thread_id = GetCurrentThreadId();
+# ifdef GC_ASSERTIONS
+    DWORD thread_id = GetCurrentThreadId();
+# endif
   int i;
 
   GC_ASSERT(I_HOLD_LOCK());
@@ -1075,8 +1077,8 @@ GC_INNER void GC_start_world(void)
     LONG my_max = GC_get_max_thread_index();
     for (i = 0; i <= my_max; i++) {
       GC_thread t = (GC_thread)(dll_thread_table + i);
-      if (t -> stack_base != 0 && t -> suspended
-          && t -> id != thread_id) {
+      if (t -> suspended) {
+        GC_ASSERT(t -> stack_base != 0 && t -> id != thread_id);
         if (ResumeThread(THREAD_HANDLE(t)) == (DWORD)-1)
           ABORT("ResumeThread failed");
         t -> suspended = FALSE;
@@ -1088,8 +1090,8 @@ GC_INNER void GC_start_world(void)
 
     for (i = 0; i < THREAD_TABLE_SZ; i++) {
       for (t = GC_threads[i]; t != 0; t = t -> tm.next) {
-        if (t -> stack_base != 0 && t -> suspended
-            && t -> id != thread_id) {
+        if (t -> suspended) {
+          GC_ASSERT(t -> stack_base != 0 && t -> id != thread_id);
           if (ResumeThread(THREAD_HANDLE(t)) == (DWORD)-1)
             ABORT("ResumeThread failed");
           UNPROTECT_THREAD(t);