Merge commit 'b22693b06d1e5d73454a65c203b4d31c1ca5b69a'
authorHendrik Leppkes <h.leppkes@gmail.com>
Sat, 10 Oct 2015 07:45:16 +0000 (09:45 +0200)
committerHendrik Leppkes <h.leppkes@gmail.com>
Sat, 10 Oct 2015 07:45:16 +0000 (09:45 +0200)
* commit 'b22693b06d1e5d73454a65c203b4d31c1ca5b69a':
  w32pthreads: Add pthread_once emulation

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
1  2 
compat/w32pthreads.h

@@@ -124,10 -118,23 +124,23 @@@ static inline int pthread_mutex_unlock(
  }
  
  #if _WIN32_WINNT >= 0x0600
 -
+ typedef INIT_ONCE pthread_once_t;
+ #define PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT
+ static av_unused int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
+ {
+     BOOL pending = FALSE;
+     InitOnceBeginInitialize(once_control, 0, &pending, NULL);
+     if (pending)
+         init_routine();
+     InitOnceComplete(once_control, 0, NULL);
+     return 0;
+ }
 -static inline void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
 +static inline int pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
  {
      InitializeConditionVariable(cond);
 +    return 0;
  }
  
  /* native condition variables do not destroy */