Add new set of callbacks to be provided by the JIT.
authorRodrigo Kumpera <kumpera@gmail.com>
Wed, 13 Apr 2011 17:20:46 +0000 (14:20 -0300)
committerRodrigo Kumpera <kumpera@gmail.com>
Wed, 13 Apr 2011 17:52:50 +0000 (14:52 -0300)
* mono-threads.h: Add MonoThreadInfoRuntimeCallbacks which
are a set of callbacks to be used by the new interruption
machinery.

mono/utils/mono-threads.c
mono/utils/mono-threads.h

index 519be4f68ddcea5d33e746cc0abff85c51449cc9..e4e152f32944911948a2713f8bab641fbef4a47b 100644 (file)
@@ -22,6 +22,7 @@
 
 static int thread_info_size;
 static MonoThreadInfoCallbacks threads_callbacks;
+static MonoThreadInfoRuntimeCallbacks runtime_callbacks;
 static MonoNativeTlsKey thread_info_key;
 static MonoLinkedListSet thread_list;
 
@@ -169,3 +170,15 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        g_assert (res);
        g_assert (sizeof (MonoNativeThreadId) == sizeof (uintptr_t));
 }
+
+void
+mono_threads_runtime_init (MonoThreadInfoRuntimeCallbacks *callbacks)
+{
+       runtime_callbacks = *callbacks;
+}
+
+MonoThreadInfoRuntimeCallbacks *
+mono_threads_get_runtime_callbacks (void)
+{
+       return &runtime_callbacks;
+}
index 70ece87af360a35a896f85ea5aeb19ac9848eb86..37a80d02dc47d25d9e66c6b71ec4a7881c786981 100644 (file)
@@ -21,6 +21,7 @@
 #include <windows.h>
 
 typedef DWORD MonoNativeThreadId;
+typedef HANDLE MonoNativeThreadHandle;
 
 #define mono_native_thread_id_get GetCurrentThreadId
 #define mono_native_thread_id_equals(a,b) ((a) == ((b))
@@ -31,7 +32,14 @@ typedef DWORD MonoNativeThreadId;
 
 #if defined(__MACH__)
 #include <mono/utils/mach-support.h>
-#endif
+
+typedef thread_port_t MonoNativeThreadHandle;
+
+#else
+
+typedef pthread_t MonoNativeThreadHandle;
+
+#endif /* defined(__MACH__) */
 
 typedef pthread_t MonoNativeThreadId;
 
@@ -55,6 +63,12 @@ typedef struct {
        void (*thread_attach)(THREAD_INFO_TYPE *info);
 } MonoThreadInfoCallbacks;
 
+typedef struct {
+       void (*setup_async_callback) (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data);
+       gboolean (*thread_state_init_from_sigctx) (MonoThreadUnwindState *state, void *sigctx);
+       gboolean (*thread_state_init_from_handle) (MonoThreadUnwindState *tctx, MonoNativeThreadId thread_id, MonoNativeThreadHandle thread_handle);
+} MonoThreadInfoRuntimeCallbacks;
+
 /*
 Requires the world to be stoped
 */
@@ -77,6 +91,11 @@ Snapshot iteration.
 void
 mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t thread_info_size) MONO_INTERNAL;
 
+void
+mono_threads_runtime_init (MonoThreadInfoRuntimeCallbacks *callbacks) MONO_INTERNAL;
+
+MonoThreadInfoRuntimeCallbacks *
+mono_threads_get_runtime_callbacks (void) MONO_INTERNAL;
 
 THREAD_INFO_TYPE *
 mono_thread_info_attach (void *baseptr) MONO_INTERNAL;