#include "mutex.h"
#include "regression.h"
#if defined(__WIN32__) && !defined(PTHREADS_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
namespace embree
{
MutexSys::MutexSys() { mutex = new CRITICAL_SECTION; InitializeCriticalSection((CRITICAL_SECTION*)mutex); }
MutexSys::~MutexSys() { DeleteCriticalSection((CRITICAL_SECTION*)mutex); delete (CRITICAL_SECTION*)mutex; }
void MutexSys::lock() { EnterCriticalSection((CRITICAL_SECTION*)mutex); }
bool MutexSys::try_lock() { return TryEnterCriticalSection((CRITICAL_SECTION*)mutex) != 0; }
void MutexSys::unlock() { LeaveCriticalSection((CRITICAL_SECTION*)mutex); }
}
#endif
#if defined(__UNIX__) || defined(PTHREADS_WIN32)
#include <pthread.h>
namespace embree
{
MutexSys::MutexSys()
{ … }
MutexSys::~MutexSys()
{ … }
void MutexSys::lock()
{ … }
bool MutexSys::try_lock() { … }
void MutexSys::unlock()
{ … }
};
#endif