- result = start_func (t_arg);
-
- mono_thread_info_detach ();
-
- return result;
-}
-
-HANDLE
-mono_threads_platform_create_thread (MonoThreadStart start_routine, gpointer arg, MonoThreadParm *tp, MonoNativeThreadId *out_tid)
-{
- ThreadStartInfo start_info;
- HANDLE result;
- DWORD thread_id;
- guint32 creation_flags = tp->creation_flags;
- int res;
-
- memset (&start_info, 0, sizeof (start_info));
- mono_coop_sem_init (&(start_info.registered), 0);
- start_info.arg = arg;
- start_info.start_routine = start_routine;
- start_info.suspend = creation_flags & CREATE_SUSPENDED;
- start_info.priority = tp->priority;
- creation_flags &= ~CREATE_SUSPENDED;
-
- result = CreateThread (NULL, tp->stack_size, inner_start_thread, &start_info, creation_flags, &thread_id);
- if (result) {
- res = mono_coop_sem_wait (&(start_info.registered), MONO_SEM_FLAGS_NONE);
- g_assert (res != -1);
-
- /* A new handle has been opened when attaching
- * the thread, so we don't need this one */
- CloseHandle (result);
- }
- if (out_tid)
- *out_tid = thread_id;
- mono_coop_sem_destroy (&(start_info.registered));
- return start_info.handle;