2008-05-07 Robert Jordan <robertj@gmx.net>
[mono.git] / libgc / pthread_stop_world.c
index 39e8d5d8eff33bca7037472344e25f8020c55ac7..04eb3712c263d9831af128e93c174c61e813635c 100644 (file)
@@ -414,6 +414,8 @@ static void pthread_stop_world()
 /* Caller holds allocation lock.       */
 void GC_stop_world()
 {
+    if (GC_notify_event)
+        GC_notify_event (GC_EVENT_PRE_STOP_WORLD);
     /* Make sure all free list construction has stopped before we start. */
     /* No new construction can start, since free list construction is  */
     /* required to acquire and release the GC lock before it starts,   */
@@ -433,6 +435,8 @@ void GC_stop_world()
 #   ifdef PARALLEL_MARK
       GC_release_mark_lock();
 #   endif
+    if (GC_notify_event)
+        GC_notify_event (GC_EVENT_POST_STOP_WORLD);
 }
 
 /* Caller holds allocation lock, and has held it continuously since    */
@@ -449,6 +453,8 @@ static void pthread_start_world()
 #   if DEBUG_THREADS
       GC_printf0("World starting\n");
 #   endif
+    if (GC_notify_event)
+        GC_notify_event (GC_EVENT_PRE_START_WORLD);
 
     for (i = 0; i < THREAD_TABLE_SZ; i++) {
       for (p = GC_threads[i]; p != 0; p = p -> next) {
@@ -488,6 +494,8 @@ static void pthread_start_world()
        }
     }
   
+    if (GC_notify_event)
+        GC_notify_event (GC_EVENT_POST_START_WORLD);
     #if DEBUG_THREADS
       GC_printf0("World started\n");
     #endif
@@ -561,19 +569,13 @@ void GC_stop_init()
 
 GCThreadFunctions *gc_thread_vtable = NULL;
 
-void
-GC_mono_debugger_add_all_threads (void)
+void *
+GC_mono_debugger_get_stack_ptr (void)
 {
-    GC_thread p;
-    int i;
+       GC_thread me;
 
-    if (gc_thread_vtable && gc_thread_vtable->thread_created) {
-       for (i = 0; i < THREAD_TABLE_SZ; i++) {
-           for (p = GC_threads[i]; p != 0; p = p -> next) {
-               gc_thread_vtable->thread_created (p->id, &p->stop_info.stack_ptr);
-           }
-       }
-    }
+       me = GC_lookup_thread (pthread_self ());
+       return &me->stop_info.stack_ptr;
 }
 
 #endif