Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Examples

LCDMutex.cpp

00001 #include "LCDMutex.h"
00002 
00003 #include <pthread.h>
00004 
00005 using namespace std;
00006 
00007 LCDMutex::LCDMutex()
00008 {
00009   ::pthread_mutex_init(&_mutex, 0);
00010   _owner = (::pthread_t)-1;
00011 }
00012 
00013 LCDMutex::~LCDMutex()
00014 {
00015   ::pthread_mutex_destroy(&_mutex);
00016 }
00017 
00018 void LCDMutex::lock()
00019 {
00020   if (_owner != ::pthread_self())
00021   {
00022     ::pthread_mutex_lock(&_mutex);
00023     _owner = ::pthread_self();
00024   }
00025 }
00026 
00027 void LCDMutex::unlock()
00028 {
00029   _owner = (::pthread_t)-1;
00030   ::pthread_mutex_unlock(&_mutex);
00031 }

Generated on Wed Aug 4 19:39:09 2004 for LCDApi by doxygen 1.3.6