mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 10:16:17 +01:00
win32 threads: use our own data, not system_thread
Stop using the generic system_thread field in GRealThread. Use our own pointer instead.
This commit is contained in:
parent
67e28068e1
commit
e0c9757b9b
@ -463,10 +463,19 @@ struct _GThreadData
|
|||||||
gboolean joinable;
|
gboolean joinable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GRealThread thread;
|
||||||
|
|
||||||
|
GThreadData *data;
|
||||||
|
} GThreadWin32;
|
||||||
|
|
||||||
void
|
void
|
||||||
g_system_thread_free (GRealThread *thread)
|
g_system_thread_free (GRealThread *thread)
|
||||||
{
|
{
|
||||||
g_slice_free (GRealThread, thread);
|
GThreadWin32 *wt = (GThreadWin32 *) thread;
|
||||||
|
|
||||||
|
g_slice_free (GThreadWin32, wt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -497,11 +506,11 @@ g_system_thread_new (GThreadFunc func,
|
|||||||
gboolean joinable,
|
gboolean joinable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GRealThread *thread;
|
GThreadWin32 *thread;
|
||||||
guint ignore;
|
guint ignore;
|
||||||
GThreadData *retval;
|
GThreadData *retval;
|
||||||
|
|
||||||
thread = g_slice_new0 (GRealThread);
|
thread = g_slice_new0 (GThreadWin32);
|
||||||
retval = g_new(GThreadData, 1);
|
retval = g_new(GThreadData, 1);
|
||||||
retval->func = func;
|
retval->func = func;
|
||||||
retval->data = thread;
|
retval->data = thread;
|
||||||
@ -518,13 +527,13 @@ g_system_thread_new (GThreadFunc func,
|
|||||||
"Error creating thread: %s", win_error);
|
"Error creating thread: %s", win_error);
|
||||||
g_free (retval);
|
g_free (retval);
|
||||||
g_free (win_error);
|
g_free (win_error);
|
||||||
g_slice_free (GRealThread, thread);
|
g_slice_free (GThreadWin32, thread);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(GThreadData **) &(thread->system_thread) = retval;
|
thread->data = retval;
|
||||||
|
|
||||||
return thread;
|
return (GRealThread *) thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -536,7 +545,8 @@ g_thread_yield (void)
|
|||||||
void
|
void
|
||||||
g_system_thread_wait (GRealThread *thread)
|
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);
|
g_return_if_fail (target->joinable);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user