From 53be713583cf00b61da8d67348a664e2ec970ddc Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 22 Feb 2001 15:39:57 +0000 Subject: [PATCH] Add missing implementation ofsource->priority, g_source_remove_poll. Thu Feb 22 10:31:36 2001 Owen Taylor * gmain.c (g_source_remove_poll): Add missing implementation ofsource->priority, g_source_remove_poll. (Pointed out by Stefan Westerfeld) --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/gmain.c | 36 ++++++++++++++++++++++++++++++++++-- gmain.c | 36 ++++++++++++++++++++++++++++++++++-- 10 files changed, 108 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index db74a39fd..87b5412a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index db74a39fd..87b5412a2 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index db74a39fd..87b5412a2 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index db74a39fd..87b5412a2 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index db74a39fd..87b5412a2 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index db74a39fd..87b5412a2 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index db74a39fd..87b5412a2 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index db74a39fd..87b5412a2 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Thu Feb 22 10:31:36 2001 Owen Taylor + + * gmain.c (g_source_remove_poll): Add missing implementation + of g_source_remove_poll. (Pointed out by Stefan Westerfeld) + 2001-02-21 Tor Lillqvist * gutils.c (g_path_is_absolute): Match also UNC paths on Win32. diff --git a/glib/gmain.c b/glib/gmain.c index b4db4d241..6435a15ce 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -896,12 +896,12 @@ g_source_get_context (GSource *source) } /** - * g_main_source_add_poll: + * g_source_add_poll: * @source:a #GSource * @fd: a #GPollFD structure holding information about a file * descriptor to watch. * - * Add a file descriptor to the set of file descriptors polled * for + * Add a file descriptor to the set of file descriptors polled for * this source. This is usually combined with g_source_new() to add an * event source. The event source's check function will typically test * the revents field in the #GPollFD struct and return %TRUE if events need @@ -931,6 +931,38 @@ g_source_add_poll (GSource *source, } } +/** + * g_source_remove_poll: + * @source:a #GSource + * @fd: a #GPollFD structure previously passed to g_source_poll. + * + * Remove a file descriptor from the set of file descriptors polled for + * this source. + **/ +void +g_source_remove_poll (GSource *source, + GPollFD *fd) +{ + GMainContext *context; + + g_return_if_fail (source != NULL); + g_return_if_fail (fd != NULL); + g_return_if_fail (!SOURCE_DESTROYED (source)); + + context = source->context; + + if (context) + LOCK_CONTEXT (context); + + source->poll_fds = g_slist_remove (source->poll_fds, fd); + + if (context) + { + g_main_context_remove_poll_unlocked (context, fd); + UNLOCK_CONTEXT (context); + } +} + /** * g_source_set_callback_indirect: * @source: the source diff --git a/gmain.c b/gmain.c index b4db4d241..6435a15ce 100644 --- a/gmain.c +++ b/gmain.c @@ -896,12 +896,12 @@ g_source_get_context (GSource *source) } /** - * g_main_source_add_poll: + * g_source_add_poll: * @source:a #GSource * @fd: a #GPollFD structure holding information about a file * descriptor to watch. * - * Add a file descriptor to the set of file descriptors polled * for + * Add a file descriptor to the set of file descriptors polled for * this source. This is usually combined with g_source_new() to add an * event source. The event source's check function will typically test * the revents field in the #GPollFD struct and return %TRUE if events need @@ -931,6 +931,38 @@ g_source_add_poll (GSource *source, } } +/** + * g_source_remove_poll: + * @source:a #GSource + * @fd: a #GPollFD structure previously passed to g_source_poll. + * + * Remove a file descriptor from the set of file descriptors polled for + * this source. + **/ +void +g_source_remove_poll (GSource *source, + GPollFD *fd) +{ + GMainContext *context; + + g_return_if_fail (source != NULL); + g_return_if_fail (fd != NULL); + g_return_if_fail (!SOURCE_DESTROYED (source)); + + context = source->context; + + if (context) + LOCK_CONTEXT (context); + + source->poll_fds = g_slist_remove (source->poll_fds, fd); + + if (context) + { + g_main_context_remove_poll_unlocked (context, fd); + UNLOCK_CONTEXT (context); + } +} + /** * g_source_set_callback_indirect: * @source: the source