diff --git a/src/xrt/auxiliary/os/os_threading.h b/src/xrt/auxiliary/os/os_threading.h index d1e7d2473..7e7ad2e28 100644 --- a/src/xrt/auxiliary/os/os_threading.h +++ b/src/xrt/auxiliary/os/os_threading.h @@ -97,6 +97,54 @@ os_mutex_destroy(struct os_mutex *om) } +/* + * + * Conditional variable. + * + */ +struct os_cond +{ + pthread_cond_t cond; +}; + +/*! + * Init. + */ +static inline int +os_cond_init(struct os_cond *oc) +{ + return pthread_cond_init(&oc->cond, NULL); +} + +/*! + * Signal. + */ +static inline void +os_cond_signal(struct os_cond *oc) +{ + pthread_cond_signal(&oc->cond); +} + +/*! + * Wait. + */ +static inline void +os_cond_wait(struct os_cond *oc, struct os_mutex *om) +{ + pthread_cond_wait(&oc->cond, &om->mutex); +} + +/*! + * Clean up. + */ +static inline void +os_cond_destroy(struct os_cond *oc) +{ + pthread_cond_destroy(&oc->cond); +} + + + /* * * Thread.