mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2026-01-23 11:16:26 +00:00
moving things around
git-svn-id: svn://qnap.local/TwoTerm/trunk@1987 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
26
cpp/Lock.cpp
Normal file
26
cpp/Lock.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user