2013-11-17 15:42:57 +00:00
|
|
|
#ifndef MP_OSDEP_THREADS_H_
|
|
|
|
#define MP_OSDEP_THREADS_H_
|
|
|
|
|
2014-02-02 16:06:49 +00:00
|
|
|
#include <stdbool.h>
|
2013-11-17 15:42:57 +00:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2014-01-31 18:50:56 +00:00
|
|
|
struct timespec mpthread_get_deadline(double timeout);
|
|
|
|
|
2013-11-17 15:42:57 +00:00
|
|
|
int mpthread_cond_timed_wait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
|
|
|
double timeout);
|
|
|
|
|
2014-01-31 18:50:25 +00:00
|
|
|
int mpthread_mutex_init_recursive(pthread_mutex_t *mutex);
|
|
|
|
|
2014-02-02 16:06:49 +00:00
|
|
|
|
|
|
|
typedef void (*mp_dispatch_fn)(void *data);
|
|
|
|
struct mp_dispatch_queue;
|
|
|
|
|
|
|
|
struct mp_dispatch_queue *mp_dispatch_create(void *talloc_parent);
|
|
|
|
void mp_dispatch_set_wakeup_fn(struct mp_dispatch_queue *queue,
|
|
|
|
void (*wakeup_fn)(void *wakeup_ctx),
|
|
|
|
void *wakeup_ctx);
|
|
|
|
void mp_dispatch_enqueue(struct mp_dispatch_queue *queue,
|
|
|
|
mp_dispatch_fn fn, void *fn_data);
|
|
|
|
void mp_dispatch_enqueue_autofree(struct mp_dispatch_queue *queue,
|
|
|
|
mp_dispatch_fn fn, void *fn_data);
|
|
|
|
void mp_dispatch_run(struct mp_dispatch_queue *queue,
|
|
|
|
mp_dispatch_fn fn, void *fn_data);
|
|
|
|
void mp_dispatch_queue_process(struct mp_dispatch_queue *queue, double timeout);
|
|
|
|
void mp_dispatch_suspend(struct mp_dispatch_queue *queue);
|
|
|
|
void mp_dispatch_resume(struct mp_dispatch_queue *queue);
|
|
|
|
void mp_dispatch_lock(struct mp_dispatch_queue *queue);
|
|
|
|
void mp_dispatch_unlock(struct mp_dispatch_queue *queue);
|
|
|
|
|
2013-11-17 15:42:57 +00:00
|
|
|
#endif
|