1
mirror of https://github.com/mpv-player/mpv synced 2024-07-11 23:47:56 +02:00
mpv/osdep/threads.h
wm4 9ba6641879 Set thread name for debugging
Especially with other components (libavcodec, OSX stuff), the thread
list can get quite populated. Setting the thread name helps when
debugging.

Since this is not portable, we check the OS variants in waf configure.
old-configure just gets a special-case for glibc, since doing a full
check here would probably be a waste of effort.
2014-10-19 23:48:40 +02:00

23 lines
704 B
C

#ifndef MP_OSDEP_THREADS_H_
#define MP_OSDEP_THREADS_H_
#include <pthread.h>
#include <inttypes.h>
// Call pthread_cond_timedwait() with an absolute timeout using the same
// time source/unit as mp_time_us() (microseconds).
int mpthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
int64_t abstime);
// Wait by a relative amount of time in seconds.
int mpthread_cond_timedwait_rel(pthread_cond_t *cond, pthread_mutex_t *mutex,
double seconds);
// Helper to reduce boiler plate.
int mpthread_mutex_init_recursive(pthread_mutex_t *mutex);
// Set thread name (for debuggers).
void mpthread_set_name(const char *name);
#endif