瀏覽代碼

MVK: fix thread local storage issues

Thomas Guillem 7 年之前
父節點
當前提交
ba63318b09
共有 17 個文件被更改,包括 226 次插入86 次删除
  1. 3 3
      Resources/MobileVLCKit/patches/0001-arm_neon-added-function-macro-to-handle-the-undersco.patch
  2. 3 3
      Resources/MobileVLCKit/patches/0002-deinterlace-merge-use-a-macro-to-fix-compilation-for.patch
  3. 3 3
      Resources/MobileVLCKit/patches/0003-arm_neon-work-around-libtool-issue.patch
  4. 3 3
      Resources/MobileVLCKit/patches/0004-arm_neon-fix-iOS-linking.patch
  5. 3 3
      Resources/MobileVLCKit/patches/0005-disable-neon-volume-plugin.patch
  6. 4 4
      Resources/MobileVLCKit/patches/0006-libvlc-create-VT-zero-copy-variable.patch
  7. 3 3
      Resources/MobileVLCKit/patches/0007-Enable-System-DL.patch
  8. 3 3
      Resources/MobileVLCKit/patches/0008-deinterlace-merge-arm64-fix-linking-on-appleOS.patch
  9. 4 4
      Resources/MobileVLCKit/patches/0009-http-add-vlc_http_cookies_clear.patch
  10. 4 4
      Resources/MobileVLCKit/patches/0010-libvlc_media-add-cookie_jar-API.patch
  11. 3 3
      Resources/MobileVLCKit/patches/0012-contrib-gcrypt-work-around-a-libtool-limitation.patch
  12. 3 3
      Resources/MobileVLCKit/patches/0013-contrib-gcrypt-fix-tvOS-compilation.patch
  13. 3 3
      Resources/MobileVLCKit/patches/0014-contrib-gcrypt-update-patches.patch
  14. 3 3
      Resources/MobileVLCKit/patches/0015-contrib-avcodec-enforce-use-of-FFmpeg.patch
  15. 3 3
      Resources/MobileVLCKit/patches/0016-build-rename-exported-symbols-by-module.patch
  16. 178 0
      Resources/MobileVLCKit/patches/0016-Replace-thread-local-with-pthread-TSD.patch
  17. 0 38
      Resources/MobileVLCKit/patches/0017-Remove-thread-local.patch

+ 3 - 3
Resources/MobileVLCKit/patches/0001-arm_neon-added-function-macro-to-handle-the-undersco.patch

@@ -1,7 +1,7 @@
-From c9f7361acdb86ce6b7a924676020e10dc699337d Mon Sep 17 00:00:00 2001
+From c7a11d516076db01f0b39cee8cbd66389c0a3492 Mon Sep 17 00:00:00 2001
 From: David Geldreich <david.geldreich@free.fr>
 Date: Fri, 20 Apr 2012 16:41:19 +0200
-Subject: [PATCH 01/17] arm_neon: added function macro to handle the underscore
+Subject: [PATCH 01/16] arm_neon: added function macro to handle the underscore
  prefix for the iOS ARM ABI
 
 ---
@@ -65,5 +65,5 @@ index 0000000000..d853255fec
 +.endm
 +
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0002-deinterlace-merge-use-a-macro-to-fix-compilation-for.patch

@@ -1,7 +1,7 @@
-From 84bfe2c741eb3d7a5221b6c9af3d8442dcf53efc Mon Sep 17 00:00:00 2001
+From ed6d6b2ed5f1fc2fb81677912fe07d1647028c9c Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Fri, 10 Aug 2012 16:02:07 +0200
-Subject: [PATCH 02/17] deinterlace/merge: use a macro to fix compilation for
+Subject: [PATCH 02/16] deinterlace/merge: use a macro to fix compilation for
  iOS
 
 ---
@@ -82,5 +82,5 @@ index dd779029ae..03e5042b28 100644
  	b		1b
 +endfunc
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0003-arm_neon-work-around-libtool-issue.patch

@@ -1,7 +1,7 @@
-From 27d983342942aa852b4d6d13e79c764a341e8608 Mon Sep 17 00:00:00 2001
+From ea3b6600a131253d221864f0fef815afccc8fdb2 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Thu, 18 Dec 2014 22:14:55 +0100
-Subject: [PATCH 03/17] arm_neon: work-around libtool issue
+Subject: [PATCH 03/16] arm_neon: work-around libtool issue
 
 ---
  modules/arm_neon/Makefile.am | 2 ++
@@ -18,5 +18,5 @@ index db81ec0b84..e67e07e61c 100644
  
  libchroma_yuv_neon_plugin_la_SOURCES = \
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0004-arm_neon-fix-iOS-linking.patch

@@ -1,7 +1,7 @@
-From 76fd3c60cf2ea129884d1e78b65e63a4d15c2268 Mon Sep 17 00:00:00 2001
+From 60f4b7c0623df8e01f24aa81ace7597fc5ea0b89 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Wed, 10 Dec 2014 22:14:55 +0100
-Subject: [PATCH 04/17] arm_neon: fix iOS linking
+Subject: [PATCH 04/16] arm_neon: fix iOS linking
 
 ---
  modules/arm_neon/amplify.S              |  7 ++---
@@ -194,5 +194,5 @@ index a94ae8539f..54b43a79e3 100644
  	pop {r4,pc}
 +endfunc
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0005-disable-neon-volume-plugin.patch

@@ -1,7 +1,7 @@
-From 06bbbb4ac3e2b71eb3650f1050bc9dce29739f73 Mon Sep 17 00:00:00 2001
+From 2f9f0c57fb5ee1183d6b7b4bbe8f4bcfe972ba78 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Wed, 10 Dec 2014 22:14:55 +0100
-Subject: [PATCH 05/17] disable neon volume plugin
+Subject: [PATCH 05/16] disable neon volume plugin
 
 ---
  modules/arm_neon/Makefile.am | 1 -
@@ -19,5 +19,5 @@ index e67e07e61c..690975235f 100644
  	libyuv_rgb_neon_plugin.la
  endif
 -- 
-2.14.1
+2.11.0
 

+ 4 - 4
Resources/MobileVLCKit/patches/0006-libvlc-create-VT-zero-copy-variable.patch

@@ -1,14 +1,14 @@
-From 864f309e698b0fa6e7d119cd1def7051ca906a04 Mon Sep 17 00:00:00 2001
+From f4c8c5e24b4fa50ea231afb46bc7bb030b71c7f9 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Wed, 4 May 2016 16:00:40 +0200
-Subject: [PATCH 06/17] libvlc: create VT-zero-copy variable
+Subject: [PATCH 06/16] libvlc: create VT-zero-copy variable
 
 ---
  lib/media_player.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/lib/media_player.c b/lib/media_player.c
-index f369b96755..ea560b37ac 100644
+index b5677ae7ec..ebe711e310 100644
 --- a/lib/media_player.c
 +++ b/lib/media_player.c
 @@ -641,6 +641,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
@@ -20,5 +20,5 @@ index f369b96755..ea560b37ac 100644
  #ifdef __ANDROID__
      var_Create (mp, "drawable-androidwindow", VLC_VAR_ADDRESS);
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0007-Enable-System-DL.patch

@@ -1,7 +1,7 @@
-From 0bc689425aa9405e4aa5827d3110258802263c7e Mon Sep 17 00:00:00 2001
+From 79be1791f01937c28daec085abe28920df964692 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Fri, 22 Jul 2016 11:11:44 +0200
-Subject: [PATCH 07/17] Enable System DL
+Subject: [PATCH 07/16] Enable System DL
 
 ---
  contrib/src/ffmpeg/patch-as-patch-can.patch | 20 ++++++++++++++++++++
@@ -58,5 +58,5 @@ index 41d16a4fb2..3e5f910e99 100644
  
  .ffmpeg: ffmpeg
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0008-deinterlace-merge-arm64-fix-linking-on-appleOS.patch

@@ -1,7 +1,7 @@
-From 5eef06742e670da0c0ee6fce93956cae8e393855 Mon Sep 17 00:00:00 2001
+From a3a9ef0bc07d174480bf76df79c86cb68f7d7291 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Mon, 12 Sep 2016 17:04:05 +0200
-Subject: [PATCH 08/17] deinterlace-merge-arm64: fix linking on appleOS
+Subject: [PATCH 08/16] deinterlace-merge-arm64: fix linking on appleOS
 
 ---
  modules/arm_neon/asm64.S                       | 46 ++++++++++++++++++++++++++
@@ -107,5 +107,5 @@ index db19e54caf..63c04d3fdd 100644
  	ret
 +endfunc
 -- 
-2.14.1
+2.11.0
 

+ 4 - 4
Resources/MobileVLCKit/patches/0009-http-add-vlc_http_cookies_clear.patch

@@ -1,7 +1,7 @@
-From 48ca0b6a93aaf025703b68eb8679062300605011 Mon Sep 17 00:00:00 2001
+From 9b30a88e8d4632a55ab20e3c02425dc3ce2504e4 Mon Sep 17 00:00:00 2001
 From: Thomas Guillem <thomas@gllm.fr>
 Date: Fri, 16 Sep 2016 15:51:10 +0200
-Subject: [PATCH 09/17] http: add vlc_http_cookies_clear
+Subject: [PATCH 09/16] http: add vlc_http_cookies_clear
 
 Clear all cookies without deleting the jar.
 ---
@@ -23,7 +23,7 @@ index ed7e1613da..da1fe4ef1a 100644
  
  /**
 diff --git a/src/libvlccore.sym b/src/libvlccore.sym
-index 929a6dcc1f..d8bac07a97 100644
+index 4f0bf20dbc..0e24d0aeac 100644
 --- a/src/libvlccore.sym
 +++ b/src/libvlccore.sym
 @@ -131,6 +131,7 @@ vlc_http_auth_ParseAuthenticationInfoHeader
@@ -61,5 +61,5 @@ index 2e4d3a8663..0929758f62 100644
  }
  
 -- 
-2.14.1
+2.11.0
 

+ 4 - 4
Resources/MobileVLCKit/patches/0010-libvlc_media-add-cookie_jar-API.patch

@@ -1,7 +1,7 @@
-From dd7bb5498f8c8724569d38c1a70d8dfe7fa50453 Mon Sep 17 00:00:00 2001
+From d26b80e6ed88694c7d72af4013b283f050d97e53 Mon Sep 17 00:00:00 2001
 From: Thomas Guillem <thomas@gllm.fr>
 Date: Fri, 16 Sep 2016 15:51:11 +0200
-Subject: [PATCH 10/17] libvlc_media: add cookie_jar API
+Subject: [PATCH 10/16] libvlc_media: add cookie_jar API
 
 ---
  include/vlc/libvlc_media.h | 35 +++++++++++++++++++++++++++++++++++
@@ -138,7 +138,7 @@ index 5a67e9ff60..0f0341e260 100644
  
  /* Media Descriptor */
 diff --git a/lib/media_player.c b/lib/media_player.c
-index ea560b37ac..5b822329eb 100644
+index ebe711e310..34b539f370 100644
 --- a/lib/media_player.c
 +++ b/lib/media_player.c
 @@ -620,6 +620,7 @@ libvlc_media_player_new( libvlc_instance_t *instance )
@@ -163,5 +163,5 @@ index ea560b37ac..5b822329eb 100644
  
      p_input_thread = input_Create( p_mi, p_mi->p_md->p_input_item, NULL,
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0012-contrib-gcrypt-work-around-a-libtool-limitation.patch

@@ -1,7 +1,7 @@
-From 3dda988fdfb85cfbc45f8d4e18356e3381b23acc Mon Sep 17 00:00:00 2001
+From d2863a49af7f361c4c6bb68a394cbe5350d9e52b Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Sun, 7 Dec 2014 20:02:18 +0100
-Subject: [PATCH 12/17] contrib/gcrypt: work-around a libtool limitation
+Subject: [PATCH 11/16] contrib/gcrypt: work-around a libtool limitation
 
 ---
  contrib/src/gcrypt/rules.mak                       |  1 +
@@ -53,5 +53,5 @@ index 0000000000..df97ffb488
 + AM_CFLAGS = $(GPG_ERROR_CFLAGS)
 + 
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0013-contrib-gcrypt-fix-tvOS-compilation.patch

@@ -1,7 +1,7 @@
-From 89768285e806d91fed1548e4c8fe47ba91089daa Mon Sep 17 00:00:00 2001
+From 70f18c642cba18e08f57202fc59d0d9fcd99a69a Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Sat, 3 Oct 2015 22:45:14 +0200
-Subject: [PATCH 13/17] contrib/gcrypt: fix tvOS compilation
+Subject: [PATCH 12/16] contrib/gcrypt: fix tvOS compilation
 
 ---
  contrib/src/gcrypt/fix-sha1-ssse3-for-clang.patch | 16 ++++++++++++++++
@@ -56,5 +56,5 @@ index c2d4b934f4..dbd556be61 100644
  GCRYPT_CONF += --disable-aesni-support
  else
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0014-contrib-gcrypt-update-patches.patch

@@ -1,7 +1,7 @@
-From bd529af4bcd5bbc9f2a6186f449971f3cf8de9c1 Mon Sep 17 00:00:00 2001
+From 3e96635d5e52db07500a373b35f32c21a7bee88e Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Mon, 12 Sep 2016 17:03:37 +0200
-Subject: [PATCH 14/17] contrib/gcrypt: update patches
+Subject: [PATCH 13/16] contrib/gcrypt: update patches
 
 ---
  contrib/src/gcrypt/fix-sha1-ssse3-for-clang.patch  | 308 ++++++++++++++++++++-
@@ -363,5 +363,5 @@ index df97ffb488..957f268ad2 100644
   
   # Need to include ../src in addition to top_srcdir because gcrypt.h is
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0015-contrib-avcodec-enforce-use-of-FFmpeg.patch

@@ -1,7 +1,7 @@
-From 74d699dbdca0481359bc9446793ea072c2254918 Mon Sep 17 00:00:00 2001
+From f59fad2b8635a7f4fe1eaf658155286281bcff55 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
 Date: Mon, 17 Jul 2017 17:05:51 +0200
-Subject: [PATCH 15/17] contrib/avcodec: enforce use of FFmpeg
+Subject: [PATCH 14/16] contrib/avcodec: enforce use of FFmpeg
 
 ---
  contrib/src/ffmpeg/rules.mak | 2 +-
@@ -21,5 +21,5 @@ index 3e5f910e99..6acb5da740 100644
  ifdef USE_FFMPEG
  FFMPEG_HASH=a82468514048fb87d9bf38689866bc3b9aaccd02
 -- 
-2.14.1
+2.11.0
 

+ 3 - 3
Resources/MobileVLCKit/patches/0016-build-rename-exported-symbols-by-module.patch

@@ -1,7 +1,7 @@
-From e45cc37fcd98f2c8f7d8a3ba616dd5b94378a245 Mon Sep 17 00:00:00 2001
+From 8ad8964668fbee7fa99fd74facb24f70b33b5af6 Mon Sep 17 00:00:00 2001
 From: Thomas Guillem <thomas@gllm.fr>
 Date: Tue, 11 Apr 2017 15:15:26 +0200
-Subject: [PATCH 16/17] build: rename exported symbols by module
+Subject: [PATCH 15/16] build: rename exported symbols by module
 
 This is quite ugly and temporary. Ideally we should rename symbols in binaries like the Android script do.
 ---
@@ -319,5 +319,5 @@ index ecc26e0d60..0c71cda6d2 100644
   * frames, each algorithm is responsible for setting the offset correctly.
   * (The default is 0, so if that is correct, there's no need to do anything.)
 -- 
-2.14.1
+2.11.0
 

+ 178 - 0
Resources/MobileVLCKit/patches/0016-Replace-thread-local-with-pthread-TSD.patch

@@ -0,0 +1,178 @@
+From c7f8367e0e5fef23db8f9a0498cbc5834fc57af2 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
+
+---
+ src/misc/interrupt.c | 34 ++++++++++++++++++++--------------
+ src/misc/variables.c | 13 ++++++++++---
+ 2 files changed, 30 insertions(+), 17 deletions(-)
+
+diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c
+index 3fafaa4183..7fdc7b8b96 100644
+--- a/src/misc/interrupt.c
++++ b/src/misc/interrupt.c
+@@ -43,13 +43,20 @@
+ #include "interrupt.h"
+ #include "libvlc.h"
+ 
+-static thread_local vlc_interrupt_t *vlc_interrupt_var;
++#include <pthread.h>
++static pthread_key_t vlc_interrupt_var_key;
++static pthread_once_t vlc_interrupt_var_key_once = PTHREAD_ONCE_INIT;
++static void vlc_interrupt_var_key_create()
++{
++    pthread_key_create(&vlc_interrupt_var_key, NULL);
++}
+ 
+ /**
+  * Initializes an interruption context.
+  */
+ void vlc_interrupt_init(vlc_interrupt_t *ctx)
+ {
++    pthread_once(&vlc_interrupt_var_key_once, vlc_interrupt_var_key_create);
+     vlc_mutex_init(&ctx->lock);
+     ctx->interrupted = false;
+     atomic_init(&ctx->killed, false);
+@@ -98,9 +105,8 @@ void vlc_interrupt_raise(vlc_interrupt_t *ctx)
+ 
+ vlc_interrupt_t *vlc_interrupt_set(vlc_interrupt_t *newctx)
+ {
+-    vlc_interrupt_t *oldctx = vlc_interrupt_var;
+-
+-    vlc_interrupt_var = newctx;
++    vlc_interrupt_t *oldctx = pthread_getspecific(vlc_interrupt_var_key);
++    pthread_setspecific(vlc_interrupt_var_key, newctx);
+     return oldctx;
+ }
+ 
+@@ -115,7 +121,7 @@ static void vlc_interrupt_prepare(vlc_interrupt_t *ctx,
+                                   void (*cb)(void *), void *data)
+ {
+     assert(ctx != NULL);
+-    assert(ctx == vlc_interrupt_var);
++    assert(ctx == pthread_getspecific(vlc_interrupt_var_key));
+ 
+     vlc_mutex_lock(&ctx->lock);
+     assert(ctx->callback == NULL);
+@@ -143,7 +149,7 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
+     int ret = 0;
+ 
+     assert(ctx != NULL);
+-    assert(ctx == vlc_interrupt_var);
++    assert(ctx == pthread_getspecific(vlc_interrupt_var_key));
+ 
+     /* Wait for pending callbacks to prevent access by other threads. */
+     vlc_mutex_lock(&ctx->lock);
+@@ -159,14 +165,14 @@ static int vlc_interrupt_finish(vlc_interrupt_t *ctx)
+ 
+ void vlc_interrupt_register(void (*cb)(void *), void *opaque)
+ {
+-    vlc_interrupt_t *ctx = vlc_interrupt_var;
++    vlc_interrupt_t *ctx = pthread_getspecific(vlc_interrupt_var_key);
+     if (ctx != NULL)
+         vlc_interrupt_prepare(ctx, cb, opaque);
+ }
+ 
+ int vlc_interrupt_unregister(void)
+ {
+-    vlc_interrupt_t *ctx = vlc_interrupt_var;
++    vlc_interrupt_t *ctx = pthread_getspecific(vlc_interrupt_var_key);
+     return (ctx != NULL) ? vlc_interrupt_finish(ctx) : 0;
+ }
+ 
+@@ -185,7 +191,7 @@ void vlc_interrupt_kill(vlc_interrupt_t *ctx)
+ 
+ bool vlc_killed(void)
+ {
+-    vlc_interrupt_t *ctx = vlc_interrupt_var;
++    vlc_interrupt_t *ctx = pthread_getspecific(vlc_interrupt_var_key);
+ 
+     return (ctx != NULL) && atomic_load(&ctx->killed);
+ }
+@@ -197,7 +203,7 @@ static void vlc_interrupt_sem(void *opaque)
+ 
+ int vlc_sem_wait_i11e(vlc_sem_t *sem)
+ {
+-    vlc_interrupt_t *ctx = vlc_interrupt_var;
++    vlc_interrupt_t *ctx = pthread_getspecific(vlc_interrupt_var_key);
+     if (ctx == NULL)
+         return vlc_sem_wait(sem), 0;
+ 
+@@ -227,7 +233,7 @@ static void vlc_mwait_i11e_cleanup(void *opaque)
+ 
+ int vlc_mwait_i11e(mtime_t deadline)
+ {
+-    vlc_interrupt_t *ctx = vlc_interrupt_var;
++    vlc_interrupt_t *ctx = pthread_getspecific(vlc_interrupt_var_key);
+     if (ctx == NULL)
+         return mwait(deadline), 0;
+ 
+@@ -262,7 +268,7 @@ void vlc_interrupt_forward_start(vlc_interrupt_t *to, void *data[2])
+ {
+     data[0] = data[1] = NULL;
+ 
+-    vlc_interrupt_t *from = vlc_interrupt_var;
++    vlc_interrupt_t *from = pthread_getspecific(vlc_interrupt_var_key);
+     if (from == NULL)
+         return;
+ 
+@@ -371,7 +377,7 @@ static int vlc_poll_i11e_inner(struct pollfd *restrict fds, unsigned nfds,
+ 
+ int vlc_poll_i11e(struct pollfd *fds, unsigned nfds, int timeout)
+ {
+-    vlc_interrupt_t *ctx = vlc_interrupt_var;
++    vlc_interrupt_t *ctx = pthread_getspecific(vlc_interrupt_var_key);
+     if (ctx == NULL)
+         return poll(fds, nfds, timeout);
+ 
+@@ -568,7 +574,7 @@ static void vlc_poll_i11e_cleanup(void *opaque)
+ 
+ int vlc_poll_i11e(struct pollfd *fds, unsigned nfds, int timeout)
+ {
+-    vlc_interrupt_t *ctx = vlc_interrupt_var;
++    vlc_interrupt_t *ctx = pthread_getspecific(vlc_interrupt_var_key);
+     if (ctx == NULL)
+         return vlc_poll(fds, nfds, timeout);
+ 
+diff --git a/src/misc/variables.c b/src/misc/variables.c
+index 87a9c27478..2b05526162 100644
+--- a/src/misc/variables.c
++++ b/src/misc/variables.c
+@@ -1378,7 +1378,13 @@ void DumpVariables(vlc_object_t *obj)
+     vlc_mutex_unlock(&vlc_internals(obj)->var_lock);
+ }
+ 
+-static thread_local void *twalk_ctx;
++#include <pthread.h>
++static pthread_key_t twalk_ctx_key;
++static pthread_once_t twalk_ctx_key_once = PTHREAD_ONCE_INIT;
++static void twalk_ctx_key_create()
++{
++    pthread_key_create(&twalk_ctx_key, NULL);
++}
+ 
+ static void TwalkGetNames(const void *data, const VISIT which, const int depth)
+ {
+@@ -1387,7 +1393,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 = pthread_getspecific(twalk_ctx_key);
+     char *dup = strdup(var->psz_name);
+     if (dup != NULL)
+         ARRAY_APPEND(*names, dup);
+@@ -1400,7 +1406,8 @@ char **var_GetAllNames(vlc_object_t *obj)
+     DECL_ARRAY(char *) names;
+     ARRAY_INIT(names);
+ 
+-    twalk_ctx = &names;
++    pthread_once(&twalk_ctx_key_once, twalk_ctx_key_create);
++    pthread_setspecific(twalk_ctx_key, &names);
+     vlc_mutex_lock(&priv->var_lock);
+     twalk(priv->var_root, TwalkGetNames);
+     vlc_mutex_unlock(&priv->var_lock);
+-- 
+2.11.0
+

+ 0 - 38
Resources/MobileVLCKit/patches/0017-Remove-thread-local.patch

@@ -1,39 +0,0 @@
-From ffe94f0d99be867e1d310b0a872895814fed5b43 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
-Date: Mon, 17 Jul 2017 17:03:24 +0200
-Subject: [PATCH 17/17] Remove thread local
-
----
- src/misc/interrupt.c | 2 +-
- src/misc/variables.c | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/misc/interrupt.c b/src/misc/interrupt.c
-index 3fafaa4183..02e1049c4b 100644
---- a/src/misc/interrupt.c
-+++ b/src/misc/interrupt.c
-@@ -43,7 +43,7 @@
- #include "interrupt.h"
- #include "libvlc.h"
- 
--static thread_local vlc_interrupt_t *vlc_interrupt_var;
-+static vlc_interrupt_t *vlc_interrupt_var;
- 
- /**
-  * Initializes an interruption context.
-diff --git a/src/misc/variables.c b/src/misc/variables.c
-index 87a9c27478..014904e83c 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_ctx;
- 
- static void TwalkGetNames(const void *data, const VISIT which, const int depth)
- {
-2.14.1
-