Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (21 sloc) 354 Bytes
#include "mutex.h"
void mutex_init(mutex_t* mutex)
{
*mutex = CreateMutex(NULL, FALSE, NULL);
}
void mutex_destroy(mutex_t* mutex)
{
CloseHandle(*mutex);
}
void mutex_lock(mutex_t* mutex)
{
WaitForSingleObject(mutex, INFINITE);
}
void mutex_unlock(mutex_t* mutex)
{
ReleaseMutex(mutex);
}
unsigned long self()
{
return GetCurrentThreadId();
}
Something went wrong with that request. Please try again.