eventstore-client-c/mutex.c
Nicolas Dextraze 716a6223a7 First commit
2018-03-18 22:44:23 -07:00

28 lines
474 B
C

//
// 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