1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- From a8a9f64d358be38fb5f5a0a85cbd4652a84a9321 Mon Sep 17 00:00:00 2001
- From: Thomas Guillem <thomas@gllm.fr>
- Date: Fri, 2 Jun 2017 15:56:34 +0200
- Subject: [PATCH 17/17] core: Fix TLS usage
- TLS is not implement on arm ios (for iPhone5). We may drop this platform for
- 4.0, so this patch is only temporary.
- ---
- src/misc/variables.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
- diff --git a/src/misc/variables.c b/src/misc/variables.c
- index 121ef5ea70..3e7b43f912 100644
- --- a/src/misc/variables.c
- +++ b/src/misc/variables.c
- @@ -1378,7 +1378,7 @@ void DumpVariables(vlc_object_t *obj)
- vlc_mutex_unlock(&vlc_internals(obj)->var_lock);
- }
-
- -static _Thread_local void *twalk_ctx;
- +static vlc_threadvar_t twalk_key;
-
- static void TwalkGetNames(const void *data, const VISIT which, const int depth)
- {
- @@ -1387,7 +1387,7 @@ static void TwalkGetNames(const void *data, const VISIT which, const int depth)
- (void) depth;
-
- const variable_t *var = *(const variable_t **)data;
- - DECL_ARRAY(char *) *names = twalk_ctx;
- + DECL_ARRAY(char *) *names = vlc_threadvar_get(twalk_key);
- char *dup = strdup(var->psz_name);
- if (dup != NULL)
- ARRAY_APPEND(*names, dup);
- @@ -1400,11 +1400,14 @@ char **var_GetAllNames(vlc_object_t *obj)
- DECL_ARRAY(char *) names;
- ARRAY_INIT(names);
-
- - twalk_ctx = &names;
- + if (vlc_threadvar_create(&twalk_key, NULL) != 0)
- + return NULL;
- + vlc_threadvar_set(twalk_key, &names);
- vlc_mutex_lock(&priv->var_lock);
- twalk(priv->var_root, TwalkGetNames);
- vlc_mutex_unlock(&priv->var_lock);
-
- + vlc_threadvar_delete(&twalk_key);
- if (names.i_size == 0)
- return NULL;
- ARRAY_APPEND(names, NULL);
- --
- 2.11.0
|