info->stackdata = g_byte_array_new ();
+ info->internal_thread_gchandle = G_MAXUINT32;
+
mono_threads_suspend_register (info);
THREADS_DEBUG ("registering info %p tid %p small id %x\n", info, mono_thread_info_get_tid (info), info->small_id);
{
/* This can happen from DllMain(DLL_THREAD_ATTACH) on Windows, if a
* thread is created before an embedding API user initialized Mono. */
- THREADS_DEBUG ("mono_thread_info_attach called before mono_threads_init\n");
+ THREADS_DEBUG ("mono_thread_info_attach called before mono_thread_info_init\n");
return NULL;
}
#endif
{
/* This can happen from DllMain(THREAD_DETACH) on Windows, if a thread
* is created before an embedding API user initialized Mono. */
- THREADS_DEBUG ("mono_thread_info_detach called before mono_threads_init\n");
+ THREADS_DEBUG ("mono_thread_info_detach called before mono_thread_info_init\n");
return;
}
#endif
}
}
+gboolean
+mono_thread_info_try_get_internal_thread_gchandle (MonoThreadInfo *info, guint32 *gchandle)
+{
+ g_assert (info);
+
+ if (info->internal_thread_gchandle == G_MAXUINT32)
+ return FALSE;
+
+ *gchandle = info->internal_thread_gchandle;
+ return TRUE;
+}
+
+void
+mono_thread_info_set_internal_thread_gchandle (MonoThreadInfo *info, guint32 gchandle)
+{
+ g_assert (info);
+ g_assert (gchandle != G_MAXUINT32);
+ info->internal_thread_gchandle = gchandle;
+}
+
+void
+mono_thread_info_unset_internal_thread_gchandle (THREAD_INFO_TYPE *info)
+{
+ g_assert (info);
+ info->internal_thread_gchandle = G_MAXUINT32;
+}
+
/*
* mono_thread_info_is_exiting:
*
#endif
void
-mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
+mono_thread_info_init (size_t info_size)
{
gboolean res;
- threads_callbacks = *callbacks;
thread_info_size = info_size;
char *sleepLimit;
#ifdef HOST_WIN32
}
void
-mono_threads_signals_init (void)
+mono_thread_info_callbacks_init (MonoThreadInfoCallbacks *callbacks)
+{
+ threads_callbacks = *callbacks;
+}
+
+void
+mono_thread_info_signals_init (void)
{
mono_threads_suspend_init_signals ();
}
void
-mono_threads_runtime_init (MonoThreadInfoRuntimeCallbacks *callbacks)
+mono_thread_info_runtime_init (MonoThreadInfoRuntimeCallbacks *callbacks)
{
runtime_callbacks = *callbacks;
}
static gboolean
is_thread_in_critical_region (MonoThreadInfo *info)
{
- MonoMethod *method;
- MonoJitInfo *ji;
gpointer stack_start;
MonoThreadUnwindState *state;
return TRUE;
/* Are we inside a GC critical region? */
- if (threads_callbacks.mono_thread_in_critical_region && threads_callbacks.mono_thread_in_critical_region (info)) {
+ if (threads_callbacks.thread_in_critical_region && threads_callbacks.thread_in_critical_region (info)) {
return TRUE;
}
if (threads_callbacks.ip_in_critical_region)
return threads_callbacks.ip_in_critical_region ((MonoDomain *) state->unwind_data [MONO_UNWIND_DATA_DOMAIN], (char *) MONO_CONTEXT_GET_IP (&state->ctx));
- ji = mono_jit_info_table_find (
- (MonoDomain *) state->unwind_data [MONO_UNWIND_DATA_DOMAIN],
- (char *) MONO_CONTEXT_GET_IP (&state->ctx));
-
- if (!ji)
- return FALSE;
-
- method = mono_jit_info_get_method (ji);
-
- return threads_callbacks.mono_method_is_critical (method);
+ return FALSE;
}
gboolean