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);
+ GC_on_collection_event(GC_EVENT_THREAD_SUSPENDED,
+ (void *)p->stop_info.mach_thread);
}
}
}
}
#endif /* PLATFORM_ANDROID */
+extern GC_on_collection_event_proc GC_on_collection_event;
+
/* We hold the allocation lock. Suspend all threads that might */
/* still be running. Return the number of suspend signals that */
/* were sent. */
{
int n_live_threads = 0;
int i;
- int thread_id;
# ifndef NACL
+# ifndef PLATFORM_ANDROID
+ pthread_t thread_id;
+# else
+ pid_t thread_id;
+# endif
GC_thread p;
# ifndef GC_OPENBSD_UTHREADS
int result;
result = android_thread_kill(thread_id, GC_sig_suspend);
# endif
if (GC_on_collection_event)
- GC_on_collection_event(GC_EVENT_THREAD_SUSPENDED, (void *)threadid);
+ GC_on_collection_event(GC_EVENT_THREAD_SUSPENDED,
+ (void *)thread_id);
switch(result) {
case ESRCH:
/* Not really there anymore. Possible? */
num_used++;
if (GC_nacl_thread_parked[i] == 1) {
num_threads_parked++;
+ if (GC_on_collection_event)
+ GC_on_collection_event(GC_EVENT_THREAD_SUSPENDED,
+ (void *)(word)i);
}
}
}
register int n_live_threads = 0;
register int result;
# endif
+# ifndef PLATFORM_ANDROID
+ pthread_t thread_id;
+# else
+ pid_t thread_id;
+# endif
# ifdef GC_NETBSD_THREADS_WORKAROUND
int code;
# endif
GC_log_printf("World starting...\n");
# endif
GC_nacl_park_threads_now = 0;
+ if (GC_on_collection_event)
+ GC_on_collection_event(GC_EVENT_THREAD_UNSUSPENDED, NULL);
+ /* TODO: Send event for every unsuspended thread. */
# endif
}