profuse/ProFUSE/Lock.cpp
ksherlock 31e5f9091b fix cap. typo
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@236 aa027e90-d47c-11dd-86d7-074df07e0730
2010-05-20 01:17:59 +00:00

29 lines
354 B
C++

#include <ProFUSE/Lock.h>
using namespace ProFUSE;
Lock::Lock()
{
pthread_mutex_init(&_mutex, NULL);
}
Lock::~Lock()
{
pthread_mutex_destroy(&_mutex);
}
void Lock::lock()
{
pthread_mutex_lock(&_mutex);
}
void Lock::unlock()
{
pthread_mutex_unlock(&_mutex);
}
bool Lock::tryLock()
{
return pthread_mutex_trylock(&_mutex) == 0;
}