[grilo] grl-net: Use libsoup context threads for libsoup 2.39 or above



commit 98fb065f9d52092d2cbf29dcdc1784f9ff087e74
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Thu Apr 26 15:36:36 2012 +0000

    grl-net: Use libsoup context threads for libsoup 2.39 or above
    
    Add SOUP_SESSION_USE_THREAD_CONTEXT to soup sessions for libsoup >= 2.39.
    
    Otherwise, it will not work
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 configure.ac          |    6 ++++++
 libs/net/Makefile.am  |    5 +++++
 libs/net/grl-net-wc.c |    7 +++++++
 3 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ac2202b..756db30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,6 +120,11 @@ PKG_CHECK_MODULES(NET, libsoup-2.4,
 PKG_CHECK_EXISTS([libsoup-2.4 >= 2.33.4],
 		 [HAVE_CACHED_LIBSOUP=yes],
 		 [HAVE_CACHED_LIBSOUP=no])
+
+PKG_CHECK_EXISTS([libsoup-2.4 >= 2.39.0],
+       [HAVE_THREAD_CONTEXT_LIBSOUP=yes],
+       [HAVE_THREAD_CONTEXT_LIBSOUP=no])
+
 AC_ARG_ENABLE([grl_net],
         AS_HELP_STRING([--enable-grl-net],
                 [Enable Grilo Net library (default: auto)]),
@@ -138,6 +143,7 @@ AC_ARG_ENABLE([grl_net],
 
 AM_CONDITIONAL(BUILD_GRILO_NET, test "x$HAVE_LIBSOUP" = "xyes")
 AM_CONDITIONAL(BUILD_GRILO_NET_WITH_CACHE, test "x$HAVE_CACHED_LIBSOUP" = "xyes")
+AM_CONDITIONAL(BUILD_GRILO_NET_WITH_THREAD_CONTEXT, test "x$HAVE_THREAD_CONTEXT_LIBSOUP" = "xyes")
 
 # ----------------------------------------------------------
 # DEBUG SUPPORT
diff --git a/libs/net/Makefile.am b/libs/net/Makefile.am
index 5414369..27f0c76 100644
--- a/libs/net/Makefile.am
+++ b/libs/net/Makefile.am
@@ -25,6 +25,11 @@ libgrlnet_ GRL_MAJORMINOR@_la_CFLAGS += \
 	-DLIBSOUP_WITH_CACHE
 endif
 
+if BUILD_GRILO_NET_WITH_THREAD_CONTEXT
+libgrlnet_ GRL_MAJORMINOR@_la_CFLAGS += \
+	-DLIBSOUP_WITH_THREAD_CONTEXT
+endif
+
 libgrlnet_ GRL_MAJORMINOR@_la_LIBADD =	\
 	$(top_builddir)/src/lib GRL_NAME@.la	\
 	$(DEPS_LIBS)				\
diff --git a/libs/net/grl-net-wc.c b/libs/net/grl-net-wc.c
index 666a6e1..2d50625 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -204,6 +204,13 @@ grl_net_wc_init (GrlNetWc *wc)
 
   wc->priv->session = soup_session_async_new ();
   wc->priv->pending = g_queue_new ();
+
+#ifdef LIBSOUP_WITH_THREAD_CONTEXT
+  g_object_set (wc->priv->session,
+                SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,
+                NULL);
+#endif
+
 #ifdef LIBSOUP_USE_UNSTABLE_REQUEST_API
   wc->priv->requester = soup_requester_new();
   soup_session_add_feature (wc->priv->session,



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