summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2015-06-23 14:39:29 +0300
committerIvan Maidanski <ivmai@mail.ru>2015-06-23 14:39:29 +0300
commit9aaeaa329b4c6eb28b259b28887f8f779fc28591 (patch)
tree46e3701d493185b8b132be5af82ec6173b9baa1b /darwin_stop_world.c
parentda3c476ec9dfd1961d99d0066b226c62233bd37d (diff)
downloadbdwgc-9aaeaa329b4c6eb28b259b28887f8f779fc28591.tar.gz
Standalone profiling callback for threads suspend/resume
* alloc.c (GC_on_collection_event, GC_set_on_collection_event, GC_get_on_collection_event): Move from misc.c. * alloc.c (GC_on_collection_event): Make STATIC. * include/private/gc_priv.h (GC_on_collection_event): Remove declaration. * include/gc.h (GC_on_collection_event_proc): Remove 2nd argument of the callback. * alloc.c (GC_try_to_collect_inner, GC_stopped_mark): Likewise. * darwin_stop_world.c (GC_suspend_thread_list, GC_stop_world, GC_thread_resume): Use GC_on_thread_event instead of GC_on_collection_event. * pthread_stop_world.c (GC_suspend_all, GC_start_world): Likewise. * win32_threads.c (GC_suspend, GC_start_world): Likewise. * include/gc.h (GC_on_collection_event_proc): Update comment. * include/gc.h (GC_set_on_collection_event, GC_get_on_collection_event): Add comment. * include/gc.h (GC_on_thread_event_proc): New callback type (only if GC_THREADS). * include/gc.h (GC_set_on_thread_event, GC_get_on_thread_event): New API function declaration (only if GC_THREADS). * include/private/gc_priv.h (GC_on_thread_event): New variable declaration (only if THREADS). * misc.c (GC_on_thread_event): New global variable (only if THREADS). * misc.c (GC_set_on_thread_event, GC_get_on_thread_event): New API function (only if THREADS).
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r--darwin_stop_world.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index 1b6d0072..718e2f5c 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -495,8 +495,8 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
}
if (!found)
GC_mach_threads_count++;
- if (GC_on_collection_event)
- GC_on_collection_event(GC_EVENT_THREAD_SUSPENDED, (void *)thread);
+ if (GC_on_thread_event)
+ GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED, (void *)thread);
}
return changed;
}
@@ -585,9 +585,9 @@ GC_INNER void GC_stop_world(void)
kern_result = thread_suspend(p->stop_info.mach_thread);
if (kern_result != KERN_SUCCESS)
ABORT("thread_suspend failed");
- if (GC_on_collection_event)
- GC_on_collection_event(GC_EVENT_THREAD_SUSPENDED,
- (void *)p->stop_info.mach_thread);
+ if (GC_on_thread_event)
+ GC_on_thread_event(GC_EVENT_THREAD_SUSPENDED,
+ (void *)p->stop_info.mach_thread);
}
}
}
@@ -628,8 +628,8 @@ GC_INLINE void GC_thread_resume(thread_act_t thread)
kern_result = thread_resume(thread);
if (kern_result != KERN_SUCCESS)
ABORT("thread_resume failed");
- if (GC_on_collection_event)
- GC_on_collection_event(GC_EVENT_THREAD_UNSUSPENDED, (void *)thread);
+ if (GC_on_thread_event)
+ GC_on_thread_event(GC_EVENT_THREAD_UNSUSPENDED, (void *)thread);
}
/* Caller holds allocation lock, and has held it continuously since */