[grilo] net: detect in runtime use-thread-context property
- From: Victor Manuel Jaquez Leal <vjaquez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] net: detect in runtime use-thread-context property
- Date: Thu, 26 Apr 2012 23:16:54 +0000 (UTC)
commit a7f2d378afebd88877030d6bc8f1e7124dff919c
Author: VÃctor Manuel JÃquez Leal <vjaquez igalia com>
Date: Thu Apr 26 21:57:51 2012 +0200
net: detect in runtime use-thread-context property
Instead of messing with autotools, it is better to know in run-time if
the required property is available.
Revert "grl-net: Use libsoup context threads for libsoup 2.39 or above"
This reverts commit 98fb065f9d52092d2cbf29dcdc1784f9ff087e74.
Signed-off-by: VÃctor Manuel JÃquez Leal <vjaquez igalia com>
configure.ac | 6 ------
libs/net/Makefile.am | 5 -----
libs/net/grl-net-wc.c | 21 ++++++++++++++++-----
3 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 756db30..ac2202b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,11 +120,6 @@ 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)]),
@@ -143,7 +138,6 @@ 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 27f0c76..5414369 100644
--- a/libs/net/Makefile.am
+++ b/libs/net/Makefile.am
@@ -25,11 +25,6 @@ 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 2d50625..c54f575 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -195,6 +195,21 @@ grl_net_wc_class_init (GrlNetWcClass *klass)
G_PARAM_STATIC_STRINGS));
}
+/*
+ * use-thread-context is available for libsoup-2.4 >= 2.39.0
+ * We check in run-time if it's available
+ */
+static void
+set_thread_context (GrlNetWc *self)
+{
+ GrlNetWcPrivate *priv = self->priv;
+ GObjectClass *klass = G_OBJECT_GET_CLASS (priv->session);
+ GParamSpec *spec = g_object_class_find_property (klass,
+ "use-thread-context");
+ if (spec)
+ g_object_set (priv->session, "use-thread-context", TRUE, NULL);
+}
+
static void
grl_net_wc_init (GrlNetWc *wc)
{
@@ -205,11 +220,7 @@ 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
+ set_thread_context (wc);
#ifdef LIBSOUP_USE_UNSTABLE_REQUEST_API
wc->priv->requester = soup_requester_new();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]