summaryrefslogtreecommitdiff
path: root/src/mossrose-mutex.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-26 12:42:30 -0500
committersanine <sanine.not@pm.me>2022-08-26 12:42:30 -0500
commitbde3e4f1bb7b8f8abca0884a7d994ee1c17a66b1 (patch)
tree825ff3669a38ec247bcc9b575a4a4ceb81534d35 /src/mossrose-mutex.c
parent8ec3f8e82acd70410515550fd1790ee5827aafdb (diff)
refactor: move mossrose.h to include/ dir
Diffstat (limited to 'src/mossrose-mutex.c')
-rw-r--r--src/mossrose-mutex.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/mossrose-mutex.c b/src/mossrose-mutex.c
deleted file mode 100644
index b6865f8..0000000
--- a/src/mossrose-mutex.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "mossrose-mutex.h"
-
-#ifdef WIN32
-#include <windows.h>
-void mossrose_mutex_init(mossrose_mutex_t *mutex)
-{
- *mutex = CreateMutex(NULL, false, NULL);
-}
-
-void mossrose_mutex_lock(mossrose_mutex_t *mutex)
-{
- WaitForSingleObject(*mutex, INFINITE);
-}
-
-int mossrose_mutex_trylock(mossrose_mutex_t *mutex)
-{
- int result = WaitForSingleObject(*mutex, 0);
- return result != WAIT_OBJECT_0;
-}
-
-void mossrose_mutex_unlock(mossrose_mutex_t *mutex)
-{
- ReleaseMutex(*mutex);
-}
-
-void mossrose_mutex_destroy(mossrose_mutex_t *mutex)
-{
- ReleaseMutex(*mutex);
-}
-
-
-#else
-#include <pthread.h>
-void mossrose_mutex_init(mossrose_mutex_t *mutex)
-{
- pthread_mutex_init(mutex, NULL);
-}
-
-void mossrose_mutex_lock(mossrose_mutex_t *mutex)
-{
- pthread_mutex_lock(mutex);
-}
-
-int mossrose_mutex_trylock(mossrose_mutex_t *mutex)
-{
- return pthread_mutex_trylock(mutex);
-}
-
-void mossrose_mutex_unlock(mossrose_mutex_t *mutex)
-{
- pthread_mutex_unlock(mutex);
-}
-
-void mossrose_mutex_destroy(mossrose_mutex_t *mutex)
-{
- pthread_mutex_destroy(mutex);
-}
-#endif