[vlc-devel] [vlc-commits] vlc_fixup: Provide a thread_local macro

remi at remlab.net remi at remlab.net
Thu Jun 15 17:41:17 CEST 2017


I would (have) put that in a separate .m4 TBH.

Le 15 juin 2017 17:22:33 GMT+03:00, "Hugo Beauzée-Luyssen" <git at videolan.org> a écrit :
>vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Jun
>15 16:17:06 2017 +0200| [d0e2ad922ac987963d1889e3caa81053508ea9f9] |
>committer: Hugo Beauzée-Luyssen
>
>vlc_fixup: Provide a thread_local macro
>
>>
>http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d0e2ad922ac987963d1889e3caa81053508ea9f9
>---
>
> configure.ac         | 11 +++++++++++
> include/vlc_fixups.h | 12 ++++++++++++
> 2 files changed, 23 insertions(+)
>
>diff --git a/configure.ac b/configure.ac
>index 43ce7a3e1a..95d960954d 100644
>--- a/configure.ac
>+++ b/configure.ac
>@@ -757,6 +757,17 @@ AC_CHECK_LIB(m,sincos, [
>   AC_LIBOBJ([sincos])
> ])
> 
>+AC_MSG_CHECKING([_Thread_local support])
>+AC_COMPILE_IFELSE([AC_LANG_SOURCE([_Thread_local int foo = 0;
>+                   int main() {}])], [
>+    AC_MSG_RESULT([ok])
>+    AC_DEFINE(HAVE_THREAD_LOCAL, 1, [Defined to 1 if C11 _Thread_local
>storage qualifier is supported])
>+],[ AC_MSG_RESULT([no])])
>+
>+dnl __STDC_NO_THREADS__ can't be trusted on some platforms.
>+dnl check for its availability explicitely
>+AC_CHECK_HEADERS([threads.h])
>+
> dnl Check for dynamic plugins
> LIBDL=""
> have_dynamic_objects="no"
>diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
>index c49b4351b4..8bfb76888f 100644
>--- a/include/vlc_fixups.h
>+++ b/include/vlc_fixups.h
>@@ -45,6 +45,18 @@
> # endif
> #endif
> 
>+#ifndef __cplusplus
>+# ifdef HAVE_THREADS_H
>+#  include <threads.h>
>+# elif !defined(thread_local)
>+#  ifdef HAVE_THREAD_LOCAL
>+#   define thread_local _Thread_local
>+#  elif defined(_MSC_VER)
>+#   define thread_local __declspec(thread)
>+#  endif
>+# endif
>+#endif
>+
> #if !defined (HAVE_GMTIME_R) || !defined (HAVE_LOCALTIME_R) \
>  || !defined (HAVE_TIMEGM)
> # include <time.h> /* time_t */
>
>_______________________________________________
>vlc-commits mailing list
>vlc-commits at videolan.org
>https://mailman.videolan.org/listinfo/vlc-commits

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170615/8e27ebdb/attachment.html>


More information about the vlc-devel mailing list