MonoThreadInfo *info;
MonoInternalThread *thread;
MonoThread *current_thread;
- HANDLE thread_handle;
MonoNativeThreadId tid;
if ((thread = mono_thread_internal_current ())) {
g_error ("Thread %"G_GSIZE_FORMAT" calling into managed code is not registered with the GC. On UNIX, this can be fixed by #include-ing <gc.h> before <pthread.h> in the file containing the thread creation code.", mono_native_thread_id_get ());
}
- thread = create_internal_thread ();
-
- thread_handle = mono_thread_info_open_handle ();
- g_assert (thread_handle);
+ info = mono_thread_info_current ();
tid=mono_native_thread_id_get ();
- thread->handle = thread_handle;
+ thread = create_internal_thread ();
+ thread->handle = mono_thread_info_get_handle (info);
thread->tid = MONO_NATIVE_THREAD_ID_TO_UINT (tid);
thread->stack_ptr = &tid;
- THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, thread_handle));
+ THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, thread->handle));
- info = mono_thread_info_current ();
- g_assert (info);
thread->thread_info = info;
thread->small_id = info->small_id;
mono_threads_platform_set_exited (info);
}
-HANDLE
-mono_threads_platform_open_handle (void)
-{
- MonoThreadInfo *info;
-
- info = mono_thread_info_current ();
- g_assert (info);
- g_assert (info->handle);
-
- mono_w32handle_ref (info->handle);
-
- return info->handle;
-}
-
int
mono_threads_get_max_stack_size (void)
{
{
}
-HANDLE
-mono_threads_platform_open_handle (void)
-{
- HANDLE thread_handle;
-
- thread_handle = GetCurrentThread ();
- g_assert (thread_handle);
-
- /*
- * The handle returned by GetCurrentThread () is a pseudo handle, so it can't be used to
- * refer to the thread from other threads for things like aborting.
- */
- DuplicateHandle (GetCurrentProcess (), thread_handle, GetCurrentProcess (), &thread_handle,
- THREAD_ALL_ACCESS, TRUE, 0);
-
- return thread_handle;
-}
-
int
mono_threads_get_max_stack_size (void)
{
mono_threads_platform_exit (0);
}
-/*
- * mono_thread_info_open_handle:
- *
- * Return a io-layer/win32 handle for the current thread.
- * The handle need to be closed by calling CloseHandle () when it is no
- * longer needed.
- */
-HANDLE
-mono_thread_info_open_handle (void)
-{
- return mono_threads_platform_open_handle ();
-}
-
/*
* mono_threads_open_thread_handle:
*
void
mono_thread_info_exit (void);
-HANDLE
-mono_thread_info_open_handle (void);
-
void
mono_thread_info_set_exited (THREAD_INFO_TYPE *info);
void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
gboolean mono_threads_platform_yield (void);
void mono_threads_platform_exit (int exit_code);
-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);