MonoThread *root_domain_thread;
gpointer interrupt_on_stop;
gsize flags;
+ gpointer android_tid;
/*
* These fields are used to avoid having to increment corlib versions
* when a new field is added to the unmanaged MonoThread structure.
*/
- gpointer unused4;
gpointer unused5;
gpointer unused6;
};
void
mono_type_initialization_cleanup (void) MONO_INTERNAL;
+int
+mono_thread_kill (MonoInternalThread *thread, int signal) MONO_INTERNAL;
+
guint32
mono_thread_get_tls_key (void) MONO_INTERNAL;
char *major_collector_opt = NULL;
struct sigaction sinfo;
+#ifdef PLATFORM_ANDROID
+ g_assert_not_reached ();
+#endif
+
/* the gc_initialized guard seems to imply this method is
idempotent, but LOCK_INIT(gc_mutex) might not be. It's
defined in sgen-gc.h as nothing, so there's no danger at
#include <mono/metadata/gc-internal.h>
+#ifdef PLATFORM_ANDROID
+#include <errno.h>
+
+extern int tkill (pid_t tid, int signal);
+#endif
+
/*#define THREAD_DEBUG(a) do { a; } while (0)*/
#define THREAD_DEBUG(a)
/*#define THREAD_WAIT_DEBUG(a) do { a; } while (0)*/
thread->handle=thread_handle;
thread->tid=tid;
+#ifdef PLATFORM_ANDROID
+ thread->android_tid = (gpointer) gettid ();
+#endif
thread->apartment_state=ThreadApartmentState_Unknown;
small_id_alloc (thread);
thread->stack_ptr = &tid;
QueueUserAPC ((PAPCFUNC)interruption_request_apc, thread->handle, NULL);
#else
/* fixme: store the state somewhere */
-#ifdef PTHREAD_POINTER_ID
- pthread_kill ((gpointer)(gsize)(thread->tid), mono_thread_get_abort_signal ());
-#else
- pthread_kill (thread->tid, mono_thread_get_abort_signal ());
-#endif
+ mono_thread_kill (thread, mono_thread_get_abort_signal ());
/*
* This will cause waits to be broken.
{
return has_tls_get;
}
+
+int
+mono_thread_kill (MonoInternalThread *thread, int signal)
+{
+#ifdef PTHREAD_POINTER_ID
+ return pthread_kill ((gpointer)(gsize)(thread->tid), mono_thread_get_abort_signal ());
+#else
+# ifdef PLATFORM_ANDROID
+ if (thread->android_tid != 0) {
+ int ret;
+ int old_errno = errno;
+
+ ret = tkill ((pid_t) thread->android_tid, signal);
+ if (ret < 0) {
+ ret = errno;
+ errno = old_errno;
+ }
+
+ return ret;
+ }
+ else
+ return pthread_kill (thread->tid, mono_thread_get_abort_signal ());
+# else
+ return pthread_kill (thread->tid, mono_thread_get_abort_signal ());
+# endif
+#endif
+}