[glib: 1/2] gmain: Clarify that g_source_set_callback() is safe on attached sources
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gmain: Clarify that g_source_set_callback() is safe on attached sources
- Date: Mon, 29 Oct 2018 22:33:11 +0000 (UTC)
commit bfe5906b40f1b00a0384401ce94da46f1d74f4c7
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Feb 12 10:53:57 2014 +0000
gmain: Clarify that g_source_set_callback() is safe on attached sources
g_source_set_callback() and g_source_set_callback_indirect() are both
safe to call zero or more times on attached sources. The change in
callback will take effect the next time the source is dispatched, after
the set_callback() call returns (it could block due to locking).
https://gitlab.gnome.org/GNOME/glib/issues/827
glib/gmain.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index 0a6857ce8..89dc57032 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -1584,6 +1584,10 @@ static GSourceCallbackFuncs g_source_callback_funcs = {
* an initial reference count on @callback_data, and thus
* @callback_funcs->unref will eventually be called once more
* than @callback_funcs->ref.
+ *
+ * It is safe to call this function multiple times on a source which has already
+ * been attached to a context. The changes will take effect for the next time
+ * the source is dispatched after this call returns.
**/
void
g_source_set_callback_indirect (GSource *source,
@@ -1640,7 +1644,11 @@ g_source_set_callback_indirect (GSource *source,
* on how to handle memory management of @data.
*
* Typically, you won't use this function. Instead use functions specific
- * to the type of source you are using.
+ * to the type of source you are using, such as g_idle_add() or g_timeout_add().
+ *
+ * It is safe to call this function multiple times on a source which has already
+ * been attached to a context. The changes will take effect for the next time
+ * the source is dispatched after this call returns.
**/
void
g_source_set_callback (GSource *source,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]