gpointer wapi_create_thread_handle (void);
-char *wapi_current_thread_desc (void);
-
extern gint32 GetThreadPriority (gpointer handle);
extern gboolean SetThreadPriority (gpointer handle, gint32 priority);
return FALSE;
}
-
-char*
-wapi_current_thread_desc (void)
-{
- MonoW32HandleThread *thread;
- MonoThreadInfo *info;
- gpointer thread_handle;
- int i;
- GString* text;
- char *res;
-
- info = mono_thread_info_current ();
-
- thread_handle = mono_thread_info_get_handle (info);
- thread = lookup_thread (thread_handle);
-
- text = g_string_new (0);
- g_string_append_printf (text, "thread handle %p state : ", thread_handle);
-
- mono_thread_info_describe_interrupt_token (info, text);
-
- g_string_append_printf (text, " owns (");
- for (i = 0; i < thread->owned_mutexes->len; i++)
- g_string_append_printf (text, i > 0 ? ", %p" : "%p", g_ptr_array_index (thread->owned_mutexes, i));
- g_string_append_printf (text, ")");
-
- res = text->str;
- g_string_free (text, FALSE);
- return res;
-}
#if 0
/* This no longer works with remote unwinding */
-#ifndef HOST_WIN32
- wapi_desc = wapi_current_thread_desc ();
- g_string_append_printf (text, " tid=0x%p this=0x%p %s\n", (gpointer)(gsize)thread->tid, thread, wapi_desc);
- free (wapi_desc);
-#endif
+ g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread);
+ mono_thread_info_describe (info, text);
+ g_string_append (text, "\n");
#endif
if (thread == mono_thread_internal_current ())
#endif
GString* text;
char *name;
-#ifndef HOST_WIN32
- char *wapi_desc;
-#endif
GError *error = NULL;
if (!thread)
else
g_string_append (text, "\n\"<unnamed thread>\"");
-#ifndef HOST_WIN32
- wapi_desc = wapi_current_thread_desc ();
- g_string_append_printf (text, " tid=0x%p this=0x%p %s\n", (gpointer)(gsize)thread->tid, thread, wapi_desc);
- free (wapi_desc);
-#endif
+ g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread);
+ mono_thread_info_describe ((MonoThreadInfo*) thread->thread_info, text);
+ g_string_append (text, "\n");
#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
if (start_ctx) {
info->handle = NULL;
}
+void
+mono_threads_platform_describe (MonoThreadInfo *info, GString *text)
+{
+ MonoW32HandleThread *thread_data;
+ int i;
+
+ g_assert (info->handle);
+
+ if (!mono_w32handle_lookup (info->handle, MONO_W32HANDLE_THREAD, (gpointer*) &thread_data))
+ g_error ("unknown thread handle %p", info->handle);
+
+ g_string_append_printf (text, "thread handle %p state : ", info->handle);
+
+ mono_thread_info_describe_interrupt_token (info, text);
+
+ g_string_append_printf (text, ", owns (");
+ for (i = 0; i < thread_data->owned_mutexes->len; i++)
+ g_string_append_printf (text, i > 0 ? ", %p" : "%p", g_ptr_array_index (thread_data->owned_mutexes, i));
+ g_string_append_printf (text, ")");
+}
+
#endif /* defined(_POSIX_VERSION) || defined(__native_client__) */
#if defined(USE_POSIX_BACKEND)
{
}
+void
+mono_threads_platform_describe (MonoThreadInfo *info, GString *text)
+{
+ /* TODO */
+}
+
#endif
g_assert (info->handle);
return info->handle;
}
+
+void
+mono_thread_info_describe (MonoThreadInfo *info, GString *text)
+{
+ mono_threads_platform_describe (info, text);
+}
HANDLE mono_threads_platform_open_handle (void);
HANDLE mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
void mono_threads_platform_set_exited (THREAD_INFO_TYPE *info);
+void mono_threads_platform_describe (THREAD_INFO_TYPE *info, GString *text);
void mono_threads_coop_begin_global_suspend (void);
void mono_threads_coop_end_global_suspend (void);
gpointer
mono_thread_info_get_handle (THREAD_INFO_TYPE *info);
+void
+mono_thread_info_describe (THREAD_INFO_TYPE *info, GString *text);
+
#endif /* __MONO_THREADS_H__ */