* If it is, the structure is freed in g_thread_join()
*/
if (!thread->thread.joinable)
- {
- /* Just to make sure, this isn't used any more */
- g_system_thread_assign (thread->system_thread, zero_thread);
- g_free (thread);
- }
+ g_free (thread);
}
}
/* This has to happen before G_LOCK, as that might call g_thread_self */
g_private_set (&g_thread_specific_private, data);
- if (thread->enumerable)
- g_enumerable_thread_add (thread);
+ if (thread->setup_func)
+ thread->setup_func (thread);
/* The lock makes sure that thread->system_thread is written,
* before thread->thread.func is called. See g_thread_new_internal().
}
GThread *
-g_thread_new_internal (const gchar *name,
- GThreadFunc func,
- gpointer data,
- gboolean joinable,
- gsize stack_size,
- gboolean enumerable,
- GError **error)
+g_thread_new_internal (const gchar *name,
+ GThreadFunc func,
+ gpointer data,
+ gboolean joinable,
+ gsize stack_size,
+ GThreadSetup setup_func,
+ GError **error)
{
GRealThread *result;
GError *local_error = NULL;
result->thread.joinable = joinable;
result->thread.func = func;
result->thread.data = data;
- result->enumerable = enumerable;
+ result->setup_func = setup_func;
result->name = name;
G_LOCK (g_thread_new);
g_system_thread_create (g_thread_create_proxy, result,
g_return_val_if_fail (thread, NULL);
g_return_val_if_fail (thread->joinable, NULL);
- g_return_val_if_fail (!g_system_thread_equal (&real->system_thread, &zero_thread), NULL);
g_system_thread_join (&real->system_thread);
/* Just to make sure, this isn't used any more */
thread->joinable = 0;
- g_system_thread_assign (real->system_thread, zero_thread);
/* the thread structure for non-joinable threads is freed upon
* thread end. We free the memory here. This will leave a loose end,
thread->thread.joinable = FALSE; /* This is a safe guess */
thread->thread.func = NULL;
thread->thread.data = NULL;
- thread->enumerable = FALSE;
-
- g_system_thread_self (&thread->system_thread);
g_private_set (&g_thread_specific_private, thread);
}