diff options
author | Lucas Meijer <lucas@unity3d.com> | 2014-07-01 13:07:15 +0200 |
---|---|---|
committer | Lucas Meijer <lucas@unity3d.com> | 2014-07-01 13:09:50 +0200 |
commit | fd4903870d93f44ffae042e10b5ec6975a2fe7b4 (patch) | |
tree | c1dbf6b6bb814b2b5742d1784355c7e2c1faaa6f /darwin_stop_world.c | |
parent | 6c5a455c722172f0defcfb77aa28b2709a191e7c (diff) | |
download | bdwgc-fd4903870d93f44ffae042e10b5ec6975a2fe7b4.tar.gz |
Implement event callbacks to be used to profile the collector
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r-- | darwin_stop_world.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c index a6b0a5c7..35a4ba7d 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -458,6 +458,8 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count, #endif /* !GC_NO_THREADS_DISCOVERY */ +extern GC_on_collection_event_proc GC_on_collection_event; + /* Caller holds allocation lock. */ GC_INNER void GC_stop_world(void) { @@ -540,6 +542,8 @@ 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_UNSUSPENDED, (void *)p->stop_info.mach_thread); } } } @@ -654,6 +658,8 @@ GC_INNER void GC_start_world(void) if ((p->flags & FINISHED) == 0 && !p->thread_blocked && p->stop_info.mach_thread != my_thread) GC_thread_resume(p->stop_info.mach_thread); + if (GC_on_collection_event) + GC_on_collection_event(GC_EVENT_THREAD_UNSUSPENDED, (void *)p->stop_info.mach_thread); } } |