mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-24 02:47:52 +02:00
Make some changes to the way that GMainContext works:
Sat Jun 30 15:49:10 2001 Owen Taylor <otaylor@redhat.com> * glib/gmain.[ch]: (Mostly patch from Sebastian Wilhemi) Make some changes to the way that GMainContext works: - a GMainContext is no longer associated with a single thread, but any thread can acquire ownership of thread and iterate. - There is a facility g_main_context_wait() for non-owner-threads to wait either for ownership or for a condition to be broadcast. - For efficiency, GMainLoop just piggybacks of of the loops mutex / condition instead of having a separate mutex/condition for each GMainLoop. * glib/gthread.[ch]: Remove hacks to store the thread's GMainContext in the GThread structures, since we no longer have the GMainContext <=> GThread correspondence. * glib/gmain.[ch]: Make g_main_context_wakeup() public so someone could completely duplicate GMainLoop with the public API. * tests/mainloop-test: Fix up to the new API. Decidedly doesn't work at the moment, but that may be the IO channel changes, or preexisting locking problems.
This commit is contained in:
@@ -74,7 +74,6 @@ typedef struct _GRealThread GRealThread;
|
||||
struct _GRealThread
|
||||
{
|
||||
GThread thread;
|
||||
GMainContext *context;
|
||||
gpointer private_data;
|
||||
gpointer retval;
|
||||
GSystemThread system_thread;
|
||||
@@ -465,8 +464,6 @@ g_static_private_free (GStaticPrivate *private_key)
|
||||
G_UNLOCK (g_thread);
|
||||
}
|
||||
|
||||
void g_main_context_destroy (GMainContext *context);
|
||||
|
||||
static void
|
||||
g_thread_cleanup (gpointer data)
|
||||
{
|
||||
@@ -487,8 +484,6 @@ g_thread_cleanup (gpointer data)
|
||||
}
|
||||
g_array_free (array, TRUE);
|
||||
}
|
||||
if (thread->context)
|
||||
g_main_context_destroy (thread->context);
|
||||
|
||||
/* We only free the thread structure, if it isn't joinable. If
|
||||
it is, the structure is freed in g_thread_join */
|
||||
@@ -560,7 +555,6 @@ g_thread_create_full (GThreadFunc func,
|
||||
result->thread.func = func;
|
||||
result->thread.data = data;
|
||||
result->private_data = NULL;
|
||||
result->context = NULL;
|
||||
G_LOCK (g_thread);
|
||||
G_THREAD_UF (thread_create, (g_thread_create_proxy, result,
|
||||
stack_size, joinable, bound, priority,
|
||||
@@ -657,7 +651,6 @@ g_thread_self (void)
|
||||
thread->thread.func = NULL;
|
||||
thread->thread.data = NULL;
|
||||
thread->private_data = NULL;
|
||||
thread->context = NULL;
|
||||
|
||||
if (g_thread_supported ())
|
||||
G_THREAD_UF (thread_self, (&thread->system_thread));
|
||||
|
Reference in New Issue
Block a user