From f87f491be6ca261f3ed063aa3cc9618f604425fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 11 Feb 2018 17:25:42 +0200 Subject: [PATCH] cpu: privatize vlc_CPU_init() --- src/libvlc.h | 1 - src/misc/cpu.c | 8 ++------ src/os2/thread.c | 1 - src/win32/thread.c | 1 - 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/libvlc.h b/src/libvlc.h index 1741238da3..7a5a6f155b 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -40,7 +40,6 @@ void system_End(void); size_t EnumClockSource( vlc_object_t *, const char *, char ***, char *** ); #endif #endif -void vlc_CPU_init(void); void vlc_CPU_dump(vlc_object_t *); /* diff --git a/src/misc/cpu.c b/src/misc/cpu.c index 1b271edd79..8451facaa2 100644 --- a/src/misc/cpu.c +++ b/src/misc/cpu.c @@ -268,12 +268,8 @@ out: */ unsigned vlc_CPU (void) { -/* On Windows and OS/2, - * initialized from DllMain() and _DLL_InitTerm() respectively, instead */ -#if !defined(_WIN32) && !defined(__OS2__) - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once (&once, vlc_CPU_init); -#endif + static vlc_once_t once = VLC_STATIC_ONCE; + vlc_once(&once, vlc_CPU_init); return cpu_flags; } #endif diff --git a/src/os2/thread.c b/src/os2/thread.c index 20f7ccd79c..8f7b335ea4 100644 --- a/src/os2/thread.c +++ b/src/os2/thread.c @@ -153,7 +153,6 @@ unsigned long _System _DLL_InitTerm(unsigned long hmod, unsigned long flag) vlc_cond_init (&super_variable); vlc_threadvar_create (&thread_key, NULL); vlc_rwlock_init (&config_lock); - vlc_CPU_init (); return 1; diff --git a/src/win32/thread.c b/src/win32/thread.c index b40f64cd52..0a6c48dd9f 100644 --- a/src/win32/thread.c +++ b/src/win32/thread.c @@ -992,7 +992,6 @@ BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) InitializeCriticalSection(&super_mutex); InitializeConditionVariable(&super_variable); vlc_rwlock_init (&config_lock); - vlc_CPU_init (); break; } -- 2.11.4.GIT