From 8ec3f8e82acd70410515550fd1790ee5827aafdb Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 26 Aug 2022 12:17:51 -0500 Subject: make sound --- src/mossrose-mutex.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/mossrose-mutex.h (limited to 'src/mossrose-mutex.h') diff --git a/src/mossrose-mutex.h b/src/mossrose-mutex.h new file mode 100644 index 0000000..84d1f63 --- /dev/null +++ b/src/mossrose-mutex.h @@ -0,0 +1,28 @@ +#ifndef MOSSROSE_MUTEX_H +#define MOSSROSE_MUTEX_H + + +#ifdef WIN32 +#include +typedef HANDLE mossrose_mutex_t; +#else +#include +typedef pthread_mutex_t mossrose_mutex_t; +#endif + +/* initialize a mutex */ +void mossrose_mutex_init(mossrose_mutex_t *mutex); + +/* lock a mutex, hanging until locked */ +void mossrose_mutex_lock(mossrose_mutex_t *mutex); + +/* attempt to lock a mutex. returns 0 on success and 1 otherwise */ +int mossrose_mutex_trylock(mossrose_mutex_t *mutex); + +/* unlock a mutex */ +void mossrose_mutex_unlock(mossrose_mutex_t *mutex); + +/* destroy a mutex */ +void mossrose_mutex_destroy(mossrose_mutex_t *mutex); + +#endif -- cgit v1.2.1