File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 3636 #if FF_HAVE_PTHREAD_NP
3737 #include <pthread_np.h>
3838 #endif
39- #define FF_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
40- typedef pthread_mutex_t FFThreadMutex ;
4139 typedef pthread_t FFThreadType ;
42- static inline void ffThreadMutexLock (FFThreadMutex * mutex ) { pthread_mutex_lock (mutex ); }
43- static inline void ffThreadMutexUnlock (FFThreadMutex * mutex ) { pthread_mutex_unlock (mutex ); }
40+ #if __APPLE__
41+ #include <os/lock.h>
42+ #define FF_THREAD_MUTEX_INITIALIZER OS_UNFAIR_LOCK_INIT
43+ typedef os_unfair_lock FFThreadMutex ;
44+ static inline void ffThreadMutexLock (os_unfair_lock * mutex ) { os_unfair_lock_lock (mutex ); }
45+ static inline void ffThreadMutexUnlock (os_unfair_lock * mutex ) { os_unfair_lock_unlock (mutex ); }
46+ #else
47+ #define FF_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
48+ typedef pthread_mutex_t FFThreadMutex ;
49+ static inline void ffThreadMutexLock (FFThreadMutex * mutex ) { pthread_mutex_lock (mutex ); }
50+ static inline void ffThreadMutexUnlock (FFThreadMutex * mutex ) { pthread_mutex_unlock (mutex ); }
51+ #endif
4452 static inline FFThreadType ffThreadCreate (void * (* func )(void * ), void * data ) {
4553 FFThreadType newThread = 0 ;
4654 pthread_create (& newThread , NULL , func , data );
You can’t perform that action at this time.
0 commit comments