mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 14:52:43 +00:00
f47a4fc3d9
Use the time as returned by mp_time_us() for mpthread_cond_timedwait(), instead of calculating the struct timespec value based on a timeout. This (probably) makes it easier to wait for a specific deadline.
20 lines
625 B
C
20 lines
625 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);
|
|
|
|
#endif
|