mirror of
https://github.com/ksherlock/profuse.git
synced 2025-01-06 11:29:32 +00:00
31e5f9091b
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@236 aa027e90-d47c-11dd-86d7-074df07e0730
29 lines
354 B
C++
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;
|
|
}
|