/* guaranteed to be dead, but we may */
/* not yet have registered the join.) */
pthread_t id;
+#ifdef PLATFORM_ANDROID
+ pid_t kernel_id;
+#endif
/* Extra bookkeeping information the stopping code uses */
struct thread_stop_info stop_info;
pthread_t GC_stopping_thread;
int GC_stopping_pid;
+#ifdef PLATFORM_ANDROID
+int android_thread_kill(pid_t tid, int sig)
+{
+ int ret;
+ int old_errno = errno;
+
+ ret = tkill(tid, sig);
+ if (ret < 0) {
+ ret = errno;
+ errno = old_errno;
+ }
+
+ return ret;
+}
+#endif
+
/* We hold the allocation lock. Suspend all threads that might */
/* still be running. Return the number of suspend signals that */
/* were sent. */
#if DEBUG_THREADS
GC_printf1("Sending suspend signal to 0x%lx\n", p -> id);
#endif
-
+
+#ifndef PLATFORM_ANDROID
result = pthread_kill(p -> id, SIG_SUSPEND);
+#else
+ result = android_thread_kill(p -> kernel_id, SIG_SUSPEND);
+#endif
switch(result) {
case ESRCH:
/* Not really there anymore. Possible? */
#if DEBUG_THREADS
GC_printf1("Sending restart signal to 0x%lx\n", p -> id);
#endif
-
+
+#ifndef PLATFORM_ANDROID
result = pthread_kill(p -> id, SIG_THR_RESTART);
+#else
+ result = android_thread_kill(p -> kernel_id, SIG_THR_RESTART);
+#endif
switch(result) {
case ESRCH:
/* Not really there anymore. Possible? */
}
if (result == 0) return(0);
result -> id = id;
+#ifdef PLATFORM_ANDROID
+ result -> kernel_id = gettid();
+#endif
result -> next = GC_threads[hv];
GC_threads[hv] = result;
GC_ASSERT(result -> flags == 0 && result -> thread_blocked == 0);