diff options
author | Daniel Kang <ddkang@google.com> | 2012-08-13 16:50:03 -0700 |
---|---|---|
committer | Daniel Kang <ddkang@google.com> | 2012-08-14 09:33:22 -0700 |
commit | fd084b2489e5c80a19b72f9b6264bda5eec67fb6 (patch) | |
tree | fbfbc0c47c0d9b8217ba59d94f0674185fd1e37d /vp8/common/rtcd.c | |
parent | 8fb9f083f2a2e5409e6eed74c3ae5f68ae6ee524 (diff) | |
download | libvpx-fd084b2489e5c80a19b72f9b6264bda5eec67fb6.tar libvpx-fd084b2489e5c80a19b72f9b6264bda5eec67fb6.tar.gz libvpx-fd084b2489e5c80a19b72f9b6264bda5eec67fb6.tar.bz2 libvpx-fd084b2489e5c80a19b72f9b6264bda5eec67fb6.zip |
Shut up warnings added by -Wundef
Change-Id: I9c7ef4a75c37aa0e10df75e165e3066614c955ef
Diffstat (limited to 'vp8/common/rtcd.c')
-rw-r--r-- | vp8/common/rtcd.c | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/vp8/common/rtcd.c b/vp8/common/rtcd.c index 4980f48ad..a7bb92ce4 100644 --- a/vp8/common/rtcd.c +++ b/vp8/common/rtcd.c @@ -11,59 +11,20 @@ #define RTCD_C #include "vpx_rtcd.h" -#if CONFIG_MULTITHREAD && HAVE_PTHREAD_H -#include <pthread.h> -static void once(void (*func)(void)) -{ - static pthread_once_t lock = PTHREAD_ONCE_INIT; - pthread_once(&lock, func); -} - - -#elif CONFIG_MULTITHREAD && defined(_WIN32) -#include <windows.h> -static void once(void (*func)(void)) -{ - /* Using a static initializer here rather than InitializeCriticalSection() - * since there's no race-free context in which to execute it. Protecting - * it with an atomic op like InterlockedCompareExchangePointer introduces - * an x86 dependency, and InitOnceExecuteOnce requires Vista. - */ - static CRITICAL_SECTION lock = {(void *)-1, -1, 0, 0, 0, 0}; - static int done; - - EnterCriticalSection(&lock); - - if (!done) - { - func(); - done = 1; - } - - LeaveCriticalSection(&lock); -} - - -#else /* No-op version that performs no synchronization. vpx_rtcd() is idempotent, * so as long as your platform provides atomic loads/stores of pointers * no synchronization is strictly necessary. */ -static void once(void (*func)(void)) -{ - static int done; +static void once(void (*func)(void)) { + static int done; - if(!done) - { - func(); - done = 1; - } + if(!done) { + func(); + done = 1; + } } -#endif - -void vpx_rtcd() -{ - once(setup_rtcd_internal); +void vpx_rtcd() { + once(setup_rtcd_internal); } |