[glib-networking/wip/pwithnall/dtls: 11/13] gnutls-connection: Use non-GClosure dummy callback
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/wip/pwithnall/dtls: 11/13] gnutls-connection: Use non-GClosure dummy callback
- Date: Thu, 2 Nov 2017 13:33:11 +0000 (UTC)
commit e85aba8b74d1c3869983f7058d9fb9c2e63a61b2
Author: Olivier CrĂȘte <olivier crete collabora com>
Date: Fri Feb 12 22:29:04 2016 -0500
gnutls-connection: Use non-GClosure dummy callback
GClosures are a bit costly, so avoid them.
https://bugzilla.gnome.org/show_bug.cgi?id=697908
tls/gnutls/gtlsconnection-gnutls.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/tls/gnutls/gtlsconnection-gnutls.c b/tls/gnutls/gtlsconnection-gnutls.c
index 805f3ea..bf9b5eb 100644
--- a/tls/gnutls/gtlsconnection-gnutls.c
+++ b/tls/gnutls/gtlsconnection-gnutls.c
@@ -1091,6 +1091,15 @@ gnutls_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
gnutls_source_sync (GTlsConnectionGnutlsSource *gnutls_source)
{
@@ -1140,7 +1149,7 @@ gnutls_source_sync (GTlsConnectionGnutlsSource *gnutls_source)
else
gnutls_source->child_source = g_timeout_source_new (0);
- g_source_set_dummy_callback (gnutls_source->child_source);
+ g_source_set_callback (gnutls_source->child_source, dummy_callback, NULL, NULL);
g_source_add_child_source ((GSource *)gnutls_source, gnutls_source->child_source);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]