mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 15:48:54 +02:00
Revert unauthorized changes.
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com> * gmain.[ch]: Revert unauthorized changes.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
Tue Dec 12 15:18:10 2000 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
|
* gmain.[ch]: Revert unauthorized changes.
|
||||||
|
|
||||||
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
2000-12-12 Elliot Lee <sopwith@redhat.com>
|
||||||
|
|
||||||
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
* gmain.c, gmain.h (g_main_context_new, g_main_context_destroy):
|
||||||
|
121
glib/gmain.c
121
glib/gmain.c
@@ -485,9 +485,9 @@ g_poll (GPollFD *fds,
|
|||||||
|
|
||||||
#endif /* !HAVE_POLL */
|
#endif /* !HAVE_POLL */
|
||||||
|
|
||||||
/* Called to clean up, usually when a thread terminates
|
/* Called to clean up when a thread terminates
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
g_main_context_destroy (GMainContext *context)
|
g_main_context_destroy (GMainContext *context)
|
||||||
{
|
{
|
||||||
GSource *source;
|
GSource *source;
|
||||||
@@ -527,73 +527,6 @@ g_main_context_destroy (GMainContext *context)
|
|||||||
g_free (context);
|
g_free (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* g_main_context_new:
|
|
||||||
* @thread: a #GThread (may be NULL)
|
|
||||||
*
|
|
||||||
* This will create a main-loop context. The context will need to be destroyed
|
|
||||||
* via g_main_context_destroy.
|
|
||||||
*
|
|
||||||
* Return value: a new main loop context.
|
|
||||||
**/
|
|
||||||
GMainContext *
|
|
||||||
g_main_context_new(GThread *thread)
|
|
||||||
{
|
|
||||||
GMainContext *context;
|
|
||||||
|
|
||||||
context = g_new0 (GMainContext, 1);
|
|
||||||
|
|
||||||
#ifdef G_THREADS_ENABLED
|
|
||||||
if (g_thread_supported ())
|
|
||||||
context->mutex = g_mutex_new();
|
|
||||||
|
|
||||||
context->thread = thread;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
context->next_id = 1;
|
|
||||||
|
|
||||||
context->source_list = NULL;
|
|
||||||
|
|
||||||
#if HAVE_POLL
|
|
||||||
context->poll_func = (GPollFunc)poll;
|
|
||||||
#else
|
|
||||||
context->poll_func = g_poll;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
context->cached_poll_array = NULL;
|
|
||||||
context->cached_poll_array_size = 0;
|
|
||||||
|
|
||||||
context->pending_dispatches = g_ptr_array_new ();
|
|
||||||
|
|
||||||
context->time_is_current = FALSE;
|
|
||||||
|
|
||||||
#ifdef G_THREADS_ENABLED
|
|
||||||
if (g_thread_supported ())
|
|
||||||
{
|
|
||||||
#ifndef G_OS_WIN32
|
|
||||||
if (pipe (context->wake_up_pipe) < 0)
|
|
||||||
g_error ("Cannot create pipe main loop wake-up: %s\n",
|
|
||||||
g_strerror (errno));
|
|
||||||
|
|
||||||
context->wake_up_rec.fd = context->wake_up_pipe[0];
|
|
||||||
context->wake_up_rec.events = G_IO_IN;
|
|
||||||
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
|
||||||
#else
|
|
||||||
if ((context->wake_up_semaphore = CreateSemaphore (NULL, 0, 100, NULL)) == NULL)
|
|
||||||
g_error ("Cannot create wake-up semaphore: %s", g_win32_error_message (GetLastError ()));
|
|
||||||
context->wake_up_rec.fd = (gint) context->wake_up_semaphore;
|
|
||||||
context->wake_up_rec.events = G_IO_IN;
|
|
||||||
#ifdef G_MAIN_POLL_DEBUG
|
|
||||||
g_print ("wake-up semaphore: %#x\n", (guint) context->wake_up_semaphore);
|
|
||||||
#endif
|
|
||||||
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_main_context_get:
|
* g_main_context_get:
|
||||||
* @thread: a #GThread
|
* @thread: a #GThread
|
||||||
@@ -619,7 +552,55 @@ g_main_context_get (GThread *thread)
|
|||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
{
|
{
|
||||||
context = g_main_context_new (thread);
|
context = g_new0 (GMainContext, 1);
|
||||||
|
|
||||||
|
#ifdef G_THREADS_ENABLED
|
||||||
|
if (g_thread_supported ())
|
||||||
|
context->mutex = g_mutex_new();
|
||||||
|
|
||||||
|
context->thread = thread;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
context->next_id = 1;
|
||||||
|
|
||||||
|
context->source_list = NULL;
|
||||||
|
|
||||||
|
#if HAVE_POLL
|
||||||
|
context->poll_func = (GPollFunc)poll;
|
||||||
|
#else
|
||||||
|
context->poll_func = g_poll;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
context->cached_poll_array = NULL;
|
||||||
|
context->cached_poll_array_size = 0;
|
||||||
|
|
||||||
|
context->pending_dispatches = g_ptr_array_new ();
|
||||||
|
|
||||||
|
context->time_is_current = FALSE;
|
||||||
|
|
||||||
|
#ifdef G_THREADS_ENABLED
|
||||||
|
if (g_thread_supported ())
|
||||||
|
{
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
|
if (pipe (context->wake_up_pipe) < 0)
|
||||||
|
g_error ("Cannot create pipe main loop wake-up: %s\n",
|
||||||
|
g_strerror (errno));
|
||||||
|
|
||||||
|
context->wake_up_rec.fd = context->wake_up_pipe[0];
|
||||||
|
context->wake_up_rec.events = G_IO_IN;
|
||||||
|
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
||||||
|
#else
|
||||||
|
if ((context->wake_up_semaphore = CreateSemaphore (NULL, 0, 100, NULL)) == NULL)
|
||||||
|
g_error ("Cannot create wake-up semaphore: %s", g_win32_error_message (GetLastError ()));
|
||||||
|
context->wake_up_rec.fd = (gint) context->wake_up_semaphore;
|
||||||
|
context->wake_up_rec.events = G_IO_IN;
|
||||||
|
#ifdef G_MAIN_POLL_DEBUG
|
||||||
|
g_print ("wake-up semaphore: %#x\n", (guint) context->wake_up_semaphore);
|
||||||
|
#endif
|
||||||
|
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_thread_supported ())
|
if (g_thread_supported ())
|
||||||
g_static_private_set_for_thread (&private_key, thread,
|
g_static_private_set_for_thread (&private_key, thread,
|
||||||
|
@@ -143,9 +143,6 @@ GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *conte
|
|||||||
|
|
||||||
/* Low level functions for implementing custom main loops.
|
/* Low level functions for implementing custom main loops.
|
||||||
*/
|
*/
|
||||||
GMainContext *g_main_context_new (GThread *thread);
|
|
||||||
void g_main_context_destroy (GMainContext *context);
|
|
||||||
|
|
||||||
gboolean g_main_context_prepare (GMainContext *context,
|
gboolean g_main_context_prepare (GMainContext *context,
|
||||||
gint *priority);
|
gint *priority);
|
||||||
gint g_main_context_query (GMainContext *context,
|
gint g_main_context_query (GMainContext *context,
|
||||||
|
121
gmain.c
121
gmain.c
@@ -485,9 +485,9 @@ g_poll (GPollFD *fds,
|
|||||||
|
|
||||||
#endif /* !HAVE_POLL */
|
#endif /* !HAVE_POLL */
|
||||||
|
|
||||||
/* Called to clean up, usually when a thread terminates
|
/* Called to clean up when a thread terminates
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
g_main_context_destroy (GMainContext *context)
|
g_main_context_destroy (GMainContext *context)
|
||||||
{
|
{
|
||||||
GSource *source;
|
GSource *source;
|
||||||
@@ -527,73 +527,6 @@ g_main_context_destroy (GMainContext *context)
|
|||||||
g_free (context);
|
g_free (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* g_main_context_new:
|
|
||||||
* @thread: a #GThread (may be NULL)
|
|
||||||
*
|
|
||||||
* This will create a main-loop context. The context will need to be destroyed
|
|
||||||
* via g_main_context_destroy.
|
|
||||||
*
|
|
||||||
* Return value: a new main loop context.
|
|
||||||
**/
|
|
||||||
GMainContext *
|
|
||||||
g_main_context_new(GThread *thread)
|
|
||||||
{
|
|
||||||
GMainContext *context;
|
|
||||||
|
|
||||||
context = g_new0 (GMainContext, 1);
|
|
||||||
|
|
||||||
#ifdef G_THREADS_ENABLED
|
|
||||||
if (g_thread_supported ())
|
|
||||||
context->mutex = g_mutex_new();
|
|
||||||
|
|
||||||
context->thread = thread;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
context->next_id = 1;
|
|
||||||
|
|
||||||
context->source_list = NULL;
|
|
||||||
|
|
||||||
#if HAVE_POLL
|
|
||||||
context->poll_func = (GPollFunc)poll;
|
|
||||||
#else
|
|
||||||
context->poll_func = g_poll;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
context->cached_poll_array = NULL;
|
|
||||||
context->cached_poll_array_size = 0;
|
|
||||||
|
|
||||||
context->pending_dispatches = g_ptr_array_new ();
|
|
||||||
|
|
||||||
context->time_is_current = FALSE;
|
|
||||||
|
|
||||||
#ifdef G_THREADS_ENABLED
|
|
||||||
if (g_thread_supported ())
|
|
||||||
{
|
|
||||||
#ifndef G_OS_WIN32
|
|
||||||
if (pipe (context->wake_up_pipe) < 0)
|
|
||||||
g_error ("Cannot create pipe main loop wake-up: %s\n",
|
|
||||||
g_strerror (errno));
|
|
||||||
|
|
||||||
context->wake_up_rec.fd = context->wake_up_pipe[0];
|
|
||||||
context->wake_up_rec.events = G_IO_IN;
|
|
||||||
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
|
||||||
#else
|
|
||||||
if ((context->wake_up_semaphore = CreateSemaphore (NULL, 0, 100, NULL)) == NULL)
|
|
||||||
g_error ("Cannot create wake-up semaphore: %s", g_win32_error_message (GetLastError ()));
|
|
||||||
context->wake_up_rec.fd = (gint) context->wake_up_semaphore;
|
|
||||||
context->wake_up_rec.events = G_IO_IN;
|
|
||||||
#ifdef G_MAIN_POLL_DEBUG
|
|
||||||
g_print ("wake-up semaphore: %#x\n", (guint) context->wake_up_semaphore);
|
|
||||||
#endif
|
|
||||||
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_main_context_get:
|
* g_main_context_get:
|
||||||
* @thread: a #GThread
|
* @thread: a #GThread
|
||||||
@@ -619,7 +552,55 @@ g_main_context_get (GThread *thread)
|
|||||||
|
|
||||||
if (!context)
|
if (!context)
|
||||||
{
|
{
|
||||||
context = g_main_context_new (thread);
|
context = g_new0 (GMainContext, 1);
|
||||||
|
|
||||||
|
#ifdef G_THREADS_ENABLED
|
||||||
|
if (g_thread_supported ())
|
||||||
|
context->mutex = g_mutex_new();
|
||||||
|
|
||||||
|
context->thread = thread;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
context->next_id = 1;
|
||||||
|
|
||||||
|
context->source_list = NULL;
|
||||||
|
|
||||||
|
#if HAVE_POLL
|
||||||
|
context->poll_func = (GPollFunc)poll;
|
||||||
|
#else
|
||||||
|
context->poll_func = g_poll;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
context->cached_poll_array = NULL;
|
||||||
|
context->cached_poll_array_size = 0;
|
||||||
|
|
||||||
|
context->pending_dispatches = g_ptr_array_new ();
|
||||||
|
|
||||||
|
context->time_is_current = FALSE;
|
||||||
|
|
||||||
|
#ifdef G_THREADS_ENABLED
|
||||||
|
if (g_thread_supported ())
|
||||||
|
{
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
|
if (pipe (context->wake_up_pipe) < 0)
|
||||||
|
g_error ("Cannot create pipe main loop wake-up: %s\n",
|
||||||
|
g_strerror (errno));
|
||||||
|
|
||||||
|
context->wake_up_rec.fd = context->wake_up_pipe[0];
|
||||||
|
context->wake_up_rec.events = G_IO_IN;
|
||||||
|
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
||||||
|
#else
|
||||||
|
if ((context->wake_up_semaphore = CreateSemaphore (NULL, 0, 100, NULL)) == NULL)
|
||||||
|
g_error ("Cannot create wake-up semaphore: %s", g_win32_error_message (GetLastError ()));
|
||||||
|
context->wake_up_rec.fd = (gint) context->wake_up_semaphore;
|
||||||
|
context->wake_up_rec.events = G_IO_IN;
|
||||||
|
#ifdef G_MAIN_POLL_DEBUG
|
||||||
|
g_print ("wake-up semaphore: %#x\n", (guint) context->wake_up_semaphore);
|
||||||
|
#endif
|
||||||
|
g_main_context_add_poll_unlocked (context, 0, &context->wake_up_rec);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_thread_supported ())
|
if (g_thread_supported ())
|
||||||
g_static_private_set_for_thread (&private_key, thread,
|
g_static_private_set_for_thread (&private_key, thread,
|
||||||
|
3
gmain.h
3
gmain.h
@@ -143,9 +143,6 @@ GSource *g_main_context_find_source_by_funcs_user_data (GMainContext *conte
|
|||||||
|
|
||||||
/* Low level functions for implementing custom main loops.
|
/* Low level functions for implementing custom main loops.
|
||||||
*/
|
*/
|
||||||
GMainContext *g_main_context_new (GThread *thread);
|
|
||||||
void g_main_context_destroy (GMainContext *context);
|
|
||||||
|
|
||||||
gboolean g_main_context_prepare (GMainContext *context,
|
gboolean g_main_context_prepare (GMainContext *context,
|
||||||
gint *priority);
|
gint *priority);
|
||||||
gint g_main_context_query (GMainContext *context,
|
gint g_main_context_query (GMainContext *context,
|
||||||
|
Reference in New Issue
Block a user