2013-11-17 15:42:57 +00:00
|
|
|
#ifndef MP_OSDEP_THREADS_H_
|
|
|
|
#define MP_OSDEP_THREADS_H_
|
|
|
|
|
|
|
|
#include <pthread.h>
|
2014-05-18 14:36:08 +00:00
|
|
|
#include <inttypes.h>
|
2013-11-17 15:42:57 +00:00
|
|
|
|
2014-05-18 14:36:08 +00:00
|
|
|
// Call pthread_cond_timedwait() with an absolute timeout using the same
|
|
|
|
// time source/unit as mp_time_us() (microseconds).
|
2014-04-23 18:56:25 +00:00
|
|
|
int mpthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
2014-05-18 14:36:08 +00:00
|
|
|
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);
|
2013-11-17 15:42:57 +00:00
|
|
|
|
2014-05-18 14:36:08 +00:00
|
|
|
// Helper to reduce boiler plate.
|
2014-01-31 18:50:25 +00:00
|
|
|
int mpthread_mutex_init_recursive(pthread_mutex_t *mutex);
|
|
|
|
|
2014-10-19 21:32:34 +00:00
|
|
|
// Set thread name (for debuggers).
|
|
|
|
void mpthread_set_name(const char *name);
|
|
|
|
|
2013-11-17 15:42:57 +00:00
|
|
|
#endif
|