[glib-networking/mcatanzaro/base-rebase: 10/33] base: Use non-GClosure dummy callback



commit 5c2684c4b323514dc9760f0fe0c0577c49991d17
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Apr 4 22:22:56 2019 -0500

    base: Use non-GClosure dummy callback
    
    Port of a3ac39b6d437aae147cfb47abc571e7ed41ff2e9

 tls/base/gtlsconnection-base.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 5c164ef..f94341b 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -677,6 +677,15 @@ tls_source_check (GSource *source)
   return FALSE;
 }
 
+/* Use a custom dummy callback instead of g_source_set_dummy_callback(), as that
+ * uses a GClosure and is slow. (The GClosure is necessary to deal with any
+ * function prototype.) */
+static gboolean
+dummy_callback (gpointer data)
+{
+  return G_SOURCE_CONTINUE;
+}
+
 static void
 tls_source_sync (GTlsConnectionBaseSource *tls_source)
 {
@@ -726,7 +735,7 @@ tls_source_sync (GTlsConnectionBaseSource *tls_source)
   else
     tls_source->child_source = g_timeout_source_new (0);
 
-  g_source_set_dummy_callback (tls_source->child_source);
+  g_source_set_callback (tls_source->child_source, dummy_callback, NULL, NULL);
   g_source_add_child_source ((GSource *)tls_source, tls_source->child_source);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]