g_private_set (&enumerable_thread_private, thread);
}
+
+static gpointer
+g_deprecated_thread_proxy (gpointer data)
+{
+ GRealThread *real = data;
+
+ g_enumerable_thread_add (real);
+
+ return g_thread_proxy (data);
+}
+
/**
* g_thread_create:
* @func: a function to execute in the new thread
gboolean joinable,
GError **error)
{
- return g_thread_new_internal (NULL, func, data, joinable, 0, g_enumerable_thread_add, error);
+ return g_thread_new_internal (NULL, g_deprecated_thread_proxy, func, data, joinable, 0, error);
}
/**
GThreadPriority priority,
GError **error)
{
- return g_thread_new_internal (NULL, func, data, joinable, stack_size, g_enumerable_thread_add, error);
+ return g_thread_new_internal (NULL, g_deprecated_thread_proxy, func, data, joinable, stack_size, error);
}
}
}
-static gpointer
-g_thread_create_proxy (gpointer data)
+gpointer
+g_thread_proxy (gpointer data)
{
GRealThread* thread = data;
/* This has to happen before G_LOCK, as that might call g_thread_self */
g_private_set (&g_thread_specific_private, data);
- 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().
*/
gboolean joinable,
GError **error)
{
- return g_thread_new_internal (name, func, data, joinable, 0, FALSE, error);
+ return g_thread_new_internal (name, g_thread_proxy, func, data, joinable, 0, error);
}
/**
gsize stack_size,
GError **error)
{
- return g_thread_new_internal (name, func, data, joinable, stack_size, FALSE, error);
+ return g_thread_new_internal (name, g_thread_proxy, func, data, joinable, stack_size, error);
}
GThread *
g_thread_new_internal (const gchar *name,
+ GThreadFunc proxy,
GThreadFunc func,
gpointer data,
gboolean joinable,
gsize stack_size,
- GThreadSetup setup_func,
GError **error)
{
GRealThread *result;
result->thread.joinable = joinable;
result->thread.func = func;
result->thread.data = data;
- result->setup_func = setup_func;
result->name = name;
G_LOCK (g_thread_new);
- g_system_thread_create (g_thread_create_proxy, result,
- stack_size, joinable,
+ g_system_thread_create (proxy, result, stack_size, joinable,
&result->system_thread, &local_error);
G_UNLOCK (g_thread_new);
G_BEGIN_DECLS
typedef struct _GRealThread GRealThread;
-typedef void (*GThreadSetup) (GRealThread *thread);
G_GNUC_INTERNAL void g_system_thread_join (gpointer thread);
G_GNUC_INTERNAL void g_system_thread_create (GThreadFunc func,
G_GNUC_INTERNAL void g_system_thread_set_name (const gchar *name);
G_GNUC_INTERNAL GThread *g_thread_new_internal (const gchar *name,
+ GThreadFunc proxy,
GThreadFunc func,
gpointer data,
gboolean joinable,
gsize stack_size,
- GThreadSetup setup_func,
GError **error);
+G_GNUC_INTERNAL
+gpointer g_thread_proxy (gpointer thread);
+
struct _GRealThread
{
GThread thread;
const gchar *name;
- GThreadSetup setup_func;
gpointer retval;
GSystemThread system_thread;
};