summaryrefslogtreecommitdiff
path: root/src/mutex.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-08-28 11:25:44 -0500
committersanine <sanine.not@pm.me>2022-08-28 11:25:44 -0500
commit0d6ece00397ebb9215ccf1af06cce22c3a94197e (patch)
tree022cc796822a998a59d8bf8896f02599ce6d3700 /src/mutex.c
parenta4dd0ad63c00f4dee3b86dfd3075d1d61b2b3180 (diff)
begin plibsys refactor
Diffstat (limited to 'src/mutex.c')
-rw-r--r--src/mutex.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/mutex.c b/src/mutex.c
deleted file mode 100644
index 4a51fa8..0000000
--- a/src/mutex.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "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