diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-08-08 10:42:32 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-08-20 11:33:29 +0300 |
commit | 1cc35a33e4cff2c8e0cd4c5952ed0afb3a832824 (patch) | |
tree | a1b82f9c22c6ba2fd351ec0c9bc75e18e08dce3a | |
parent | 09c790d99fabc2e39e57c4a895b32dd7a5cce630 (diff) | |
download | pacrunner-1cc35a33e4cff2c8e0cd4c5952ed0afb3a832824.tar.gz |
mozjs: Use pthread mutex instead of GLib versions
GLib's thread API got deprecated 2.32. Fallback to use plain pthread
APIs instead.
-rw-r--r-- | plugins/mozjs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/mozjs.c b/plugins/mozjs.c index f96bc94..766df75 100644 --- a/plugins/mozjs.c +++ b/plugins/mozjs.c @@ -27,6 +27,7 @@ #include <unistd.h> #include <string.h> #include <sys/ioctl.h> +#include <pthread.h> #include <netdb.h> #include <arpa/inet.h> @@ -41,7 +42,7 @@ #include "pacrunner.h" #include "js.h" -static GStaticMutex mozjs_mutex = G_STATIC_MUTEX_INIT; +static pthread_mutex_t mozjs_mutex = PTHREAD_MUTEX_INITIALIZER; static struct pacrunner_proxy *current_proxy = NULL; @@ -221,7 +222,7 @@ static char * mozjs_execute(const char *url, const char *host) if (jsctx == NULL) return NULL; - g_static_mutex_lock(&mozjs_mutex); + pthread_mutex_lock(&mozjs_mutex); JS_BeginRequest(jsctx); @@ -235,7 +236,7 @@ static char * mozjs_execute(const char *url, const char *host) JS_MaybeGC(jsctx); - g_static_mutex_unlock(&mozjs_mutex); + pthread_mutex_unlock(&mozjs_mutex); if (result) { answer = JS_EncodeString(jsctx, JS_ValueToString(jsctx, rval)); |