eventstore-client-c/mutex.c

28 lines
474 B
C
Raw Normal View History

2018-03-19 05:44:23 +00:00
//
// Created by nicol on 2018-03-18.
//
#ifdef _WIN32
#include <windows.h>
#endif
#include "mutex.h"
#ifdef _WIN32
mutex_t mutex_create() {
mutex_t mutex = malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(mutex);
return mutex;
}
void mutex_lock(mutex_t mutex) {
EnterCriticalSection(mutex);
}
void mutex_unlock(mutex_t mutex) {
LeaveCriticalSection(mutex);
}
void mutex_destroy(mutex_t mutex) {
DeleteCriticalSection(mutex);
}
#endif