git-svn-id: https://profuse.googlecode.com/svn/branches/v2@68 aa027e90-d47c-11dd-86d7-074df07e0730

This commit is contained in:
ksherlock
2009-11-21 01:45:08 +00:00
parent 85c84a6a80
commit a3cc7627b8
23 changed files with 2070 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#include "Lock.h"
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;
}