[vlc-commits] cpu: privatize vlc_CPU_init()
Rémi Denis-Courmont
git at videolan.org
Sun Feb 11 17:05:44 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 11 17:25:42 2018 +0200| [f87f491be6ca261f3ed063aa3cc9618f604425fd] | committer: Rémi Denis-Courmont
cpu: privatize vlc_CPU_init()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f87f491be6ca261f3ed063aa3cc9618f604425fd
---
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;
}
More information about the vlc-commits
mailing list