|
@@ -1,25 +1,21 @@
|
|
|
-From 41518beee68b6fe0b5070edd99dd559d49f0fc9b Mon Sep 17 00:00:00 2001
|
|
|
+From 9f5842c37d2f63025a8c44ff82bdbab562d923ac Mon Sep 17 00:00:00 2001
|
|
|
From: Thomas Guillem <thomas@gllm.fr>
|
|
|
Date: Mon, 17 Jul 2017 17:03:24 +0200
|
|
|
-Subject: [PATCH 16/16] Replace thread local with pthread TSD
|
|
|
+Subject: [PATCH 14/14] Replace thread local with pthread TSD
|
|
|
|
|
|
---
|
|
|
- src/misc/interrupt.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
- src/misc/variables.c | 23 +++++++++++++++++++
|
|
|
- 2 files changed, 86 insertions(+)
|
|
|
+ src/misc/interrupt.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
+ src/misc/variables.c | 19 +++++++++++++++++
|
|
|
+ 2 files changed, 78 insertions(+)
|
|
|
|
|
|
diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c
|
|
|
-index 3fafaa4183..fc7b84fd64 100644
|
|
|
+index 3fafaa4183..476d9cfba5 100644
|
|
|
--- a/src/misc/interrupt.c
|
|
|
+++ b/src/misc/interrupt.c
|
|
|
-@@ -43,13 +43,30 @@
|
|
|
+@@ -43,13 +43,26 @@
|
|
|
#include "interrupt.h"
|
|
|
#include "libvlc.h"
|
|
|
|
|
|
-+#ifdef __x86_64__
|
|
|
-+#define I_CAN_HAZ_TSD
|
|
|
-+#endif
|
|
|
-+
|
|
|
+#ifdef I_CAN_HAZ_TSD
|
|
|
static thread_local vlc_interrupt_t *vlc_interrupt_var;
|
|
|
+#else
|
|
@@ -43,7 +39,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
vlc_mutex_init(&ctx->lock);
|
|
|
ctx->interrupted = false;
|
|
|
atomic_init(&ctx->killed, false);
|
|
|
-@@ -98,9 +115,15 @@ void vlc_interrupt_raise(vlc_interrupt_t *ctx)
|
|
|
+@@ -98,9 +111,15 @@ void vlc_interrupt_raise(vlc_interrupt_t *ctx)
|
|
|
|
|
|
vlc_interrupt_t *vlc_interrupt_set(vlc_interrupt_t *newctx)
|
|
|
{
|
|
@@ -59,7 +55,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
return oldctx;
|
|
|
}
|
|
|
|
|
|
-@@ -115,7 +138,11 @@ static void vlc_interrupt_prepare(vlc_interrupt_t *ctx,
|
|
|
+@@ -115,7 +134,11 @@ static void vlc_interrupt_prepare(vlc_interrupt_t *ctx,
|
|
|
void (*cb)(void *), void *data)
|
|
|
{
|
|
|
assert(ctx != NULL);
|
|
@@ -71,7 +67,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
|
|
|
vlc_mutex_lock(&ctx->lock);
|
|
|
assert(ctx->callback == NULL);
|
|
|
-@@ -143,7 +170,11 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
|
|
|
+@@ -143,7 +166,11 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
|
|
|
int ret = 0;
|
|
|
|
|
|
assert(ctx != NULL);
|
|
@@ -83,7 +79,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
|
|
|
/* Wait for pending callbacks to prevent access by other threads. */
|
|
|
vlc_mutex_lock(&ctx->lock);
|
|
|
-@@ -159,14 +190,22 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
|
|
|
+@@ -159,14 +186,22 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
|
|
|
|
|
|
void vlc_interrupt_register(void (*cb)(void *), void *opaque)
|
|
|
{
|
|
@@ -106,7 +102,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
return (ctx != NULL) ? vlc_interrupt_finish(ctx) : 0;
|
|
|
}
|
|
|
|
|
|
-@@ -185,7 +224,11 @@ void vlc_interrupt_kill(vlc_interrupt_t *ctx)
|
|
|
+@@ -185,7 +220,11 @@ void vlc_interrupt_kill(vlc_interrupt_t *ctx)
|
|
|
|
|
|
bool vlc_killed(void)
|
|
|
{
|
|
@@ -118,7 +114,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
|
|
|
return (ctx != NULL) && atomic_load(&ctx->killed);
|
|
|
}
|
|
|
-@@ -197,7 +240,11 @@ static void vlc_interrupt_sem(void *opaque)
|
|
|
+@@ -197,7 +236,11 @@ static void vlc_interrupt_sem(void *opaque)
|
|
|
|
|
|
int vlc_sem_wait_i11e(vlc_sem_t *sem)
|
|
|
{
|
|
@@ -130,7 +126,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
if (ctx == NULL)
|
|
|
return vlc_sem_wait(sem), 0;
|
|
|
|
|
|
-@@ -227,7 +274,11 @@ static void vlc_mwait_i11e_cleanup(void *opaque)
|
|
|
+@@ -227,7 +270,11 @@ static void vlc_mwait_i11e_cleanup(void *opaque)
|
|
|
|
|
|
int vlc_mwait_i11e(mtime_t deadline)
|
|
|
{
|
|
@@ -142,7 +138,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
if (ctx == NULL)
|
|
|
return mwait(deadline), 0;
|
|
|
|
|
|
-@@ -262,7 +313,11 @@ void vlc_interrupt_forward_start(vlc_interrupt_t *to, void *data[2])
|
|
|
+@@ -262,7 +309,11 @@ void vlc_interrupt_forward_start(vlc_interrupt_t *to, void *data[2])
|
|
|
{
|
|
|
data[0] = data[1] = NULL;
|
|
|
|
|
@@ -154,7 +150,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
if (from == NULL)
|
|
|
return;
|
|
|
|
|
|
-@@ -371,7 +426,11 @@ static int vlc_poll_i11e_inner(struct pollfd *restrict fds, unsigned nfds,
|
|
|
+@@ -371,7 +422,11 @@ static int vlc_poll_i11e_inner(struct pollfd *restrict fds, unsigned nfds,
|
|
|
|
|
|
int vlc_poll_i11e(struct pollfd *fds, unsigned nfds, int timeout)
|
|
|
{
|
|
@@ -166,7 +162,7 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
if (ctx == NULL)
|
|
|
return poll(fds, nfds, timeout);
|
|
|
|
|
|
-@@ -568,7 +627,11 @@ static void vlc_poll_i11e_cleanup(void *opaque)
|
|
|
+@@ -568,7 +623,11 @@ static void vlc_poll_i11e_cleanup(void *opaque)
|
|
|
|
|
|
int vlc_poll_i11e(struct pollfd *fds, unsigned nfds, int timeout)
|
|
|
{
|
|
@@ -179,17 +175,13 @@ index 3fafaa4183..fc7b84fd64 100644
|
|
|
return vlc_poll(fds, nfds, timeout);
|
|
|
|
|
|
diff --git a/src/misc/variables.c b/src/misc/variables.c
|
|
|
-index 87a9c27478..10f142bbed 100644
|
|
|
+index 87a9c27478..5d3b8ebc1f 100644
|
|
|
--- a/src/misc/variables.c
|
|
|
+++ b/src/misc/variables.c
|
|
|
-@@ -1378,7 +1378,21 @@ void DumpVariables(vlc_object_t *obj)
|
|
|
+@@ -1378,7 +1378,17 @@ void DumpVariables(vlc_object_t *obj)
|
|
|
vlc_mutex_unlock(&vlc_internals(obj)->var_lock);
|
|
|
}
|
|
|
|
|
|
-+#ifdef __x86_64__
|
|
|
-+#define I_CAN_HAZ_TSD
|
|
|
-+#endif
|
|
|
-+
|
|
|
+#ifdef I_CAN_HAZ_TSD
|
|
|
static thread_local void *twalk_ctx;
|
|
|
+#else
|
|
@@ -204,7 +196,7 @@ index 87a9c27478..10f142bbed 100644
|
|
|
|
|
|
static void TwalkGetNames(const void *data, const VISIT which, const int depth)
|
|
|
{
|
|
|
-@@ -1387,7 +1401,11 @@ static void TwalkGetNames(const void *data, const VISIT which, const int depth)
|
|
|
+@@ -1387,7 +1397,11 @@ static void TwalkGetNames(const void *data, const VISIT which, const int depth)
|
|
|
(void) depth;
|
|
|
|
|
|
const variable_t *var = *(const variable_t **)data;
|
|
@@ -216,7 +208,7 @@ index 87a9c27478..10f142bbed 100644
|
|
|
char *dup = strdup(var->psz_name);
|
|
|
if (dup != NULL)
|
|
|
ARRAY_APPEND(*names, dup);
|
|
|
-@@ -1400,7 +1418,12 @@ char **var_GetAllNames(vlc_object_t *obj)
|
|
|
+@@ -1400,7 +1414,12 @@ char **var_GetAllNames(vlc_object_t *obj)
|
|
|
DECL_ARRAY(char *) names;
|
|
|
ARRAY_INIT(names);
|
|
|
|
|
@@ -230,5 +222,5 @@ index 87a9c27478..10f142bbed 100644
|
|
|
twalk(priv->var_root, TwalkGetNames);
|
|
|
vlc_mutex_unlock(&priv->var_lock);
|
|
|
--
|
|
|
-2.11.0
|
|
|
+2.14.1
|
|
|
|