diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-10-12 22:53:52 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-10-12 22:53:52 -0400 |
commit | e0c9757b9b0d7074923f96716adb3bff07b32349 (patch) | |
tree | 9f9ae89cba4de9b8de66ca3625758870165ff28e | |
parent | 67e28068e14428afe8335a1503ea7d734419326d (diff) |
win32 threads: use our own data, not system_thread
Stop using the generic system_thread field in GRealThread. Use our own
pointer instead.
-rw-r--r-- | glib/gthread-win32.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/glib/gthread-win32.c b/glib/gthread-win32.c index c8af9c827..98c683aac 100644 --- a/glib/gthread-win32.c +++ b/glib/gthread-win32.c @@ -463,10 +463,19 @@ struct _GThreadData gboolean joinable; }; +typedef struct +{ + GRealThread thread; + + GThreadData *data; +} GThreadWin32; + void g_system_thread_free (GRealThread *thread) { - g_slice_free (GRealThread, thread); + GThreadWin32 *wt = (GThreadWin32 *) thread; + + g_slice_free (GThreadWin32, wt); } void @@ -497,11 +506,11 @@ g_system_thread_new (GThreadFunc func, gboolean joinable, GError **error) { - GRealThread *thread; + GThreadWin32 *thread; guint ignore; GThreadData *retval; - thread = g_slice_new0 (GRealThread); + thread = g_slice_new0 (GThreadWin32); retval = g_new(GThreadData, 1); retval->func = func; retval->data = thread; @@ -518,13 +527,13 @@ g_system_thread_new (GThreadFunc func, "Error creating thread: %s", win_error); g_free (retval); g_free (win_error); - g_slice_free (GRealThread, thread); + g_slice_free (GThreadWin32, thread); return NULL; } - *(GThreadData **) &(thread->system_thread) = retval; + thread->data = retval; - return thread; + return (GRealThread *) thread; } void @@ -536,7 +545,8 @@ g_thread_yield (void) void g_system_thread_wait (GRealThread *thread) { - GThreadData *target = *(GThreadData **)&(thread->system_thread); + GThreadWin32 *wt = (GThreadWin32 *) thread; + GThreadData *target = wt->data; g_return_if_fail (target->joinable); |