diff options
Diffstat (limited to 'osdep/threads.h')
-rw-r--r-- | osdep/threads.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/osdep/threads.h b/osdep/threads.h index 8633618009..b6d950e5de 100644 --- a/osdep/threads.h +++ b/osdep/threads.h @@ -1,13 +1,23 @@ #ifndef MP_OSDEP_THREADS_H_ #define MP_OSDEP_THREADS_H_ -#include <pthread.h> -#include <inttypes.h> +#include "config.h" -// Helper to reduce boiler plate. -int mpthread_mutex_init_recursive(pthread_mutex_t *mutex); +enum mp_mutex_type { + MP_MUTEX_NORMAL = 0, + MP_MUTEX_RECURSIVE, +}; -// Set thread name (for debuggers). -void mpthread_set_name(const char *name); +#define mp_mutex_init(mutex) \ + mp_mutex_init_type(mutex, MP_MUTEX_NORMAL) + +#define mp_mutex_init_type(mutex, mtype) \ + mp_mutex_init_type_internal(mutex, mtype) + +#if HAVE_WIN32_THREADS +#include "threads-win32.h" +#else +#include "threads-posix.h" +#endif #endif |