MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
include/mylib/ClMutex.h
00001 /*
00002 *
00003 * Author: Miguel Julia <mjulia@umh.es> 
00004 * 
00005 * Date:   2008
00006 * 
00007 * Class ClMutex
00008 *
00009 */
00010 
00011 #ifndef __CLMUTEX__
00012 #define __CLMUTEX__
00013 
00014 #ifndef WIN32
00015 #include <pthread.h>
00016 #else
00017 #include <windows.h>
00018 #endif
00019 
00020 
00021 /**
00022 * @brief Implements a platform independent mutual exclusion mechanism 
00023 */
00024 class ClMutex
00025 {
00026 private:
00027 
00028 #ifdef WIN32
00029         HANDLE m_mutex;
00030 #else
00031         pthread_mutex_t m_mutex;
00032 #endif
00033 
00034 public:
00035 
00036         /// constructor
00037         ClMutex(void);
00038         /// destructor
00039         virtual ~ClMutex();
00040 
00041         /// locks the mutex
00042         void lock();
00043         /// unlocks the mutex
00044         void unlock();
00045 
00046 
00047 };
00048 #endif
00049 
 All Classes Functions Variables Typedefs