Files
eepp/src/helper/haikuttf/hkmutex.cpp
spartanj 54fb10c92b Fixed mutex on HaikuTTF.
Fixed the texture font loader, that for some reason i was forcing the threaded loading.
2011-02-20 17:34:44 -03:00

41 lines
740 B
C++

#include "hkmutex.hpp"
namespace HaikuTTF {
hkMutex::hkMutex() {
#if HK_PLATFORM == HK_PLATFORM_WIN
InitializeCriticalSection(&mMutex);
#elif defined( HK_PLATFORM_POSIX )
pthread_mutex_init(&mMutex, NULL);
#endif
}
hkMutex::~hkMutex() {
#if HK_PLATFORM == HK_PLATFORM_WIN
DeleteCriticalSection(&mMutex);
#elif defined( HK_PLATFORM_POSIX )
pthread_mutex_destroy(&mMutex);
#endif
}
void hkMutex::Lock() {
#if HK_PLATFORM == HK_PLATFORM_WIN
EnterCriticalSection(&mMutex);
#elif defined( HK_PLATFORM_POSIX )
pthread_mutex_lock(&mMutex);
#endif
}
void hkMutex::Unlock() {
#if HK_PLATFORM == HK_PLATFORM_WIN
LeaveCriticalSection(&mMutex);
#elif defined( HK_PLATFORM_POSIX )
pthread_mutex_unlock(&mMutex);
#endif
}
}