IBR-DTNSuite
0.8
|
00001 /* 00002 * RWMutex.h 00003 * 00004 * Created on: 27.03.2012 00005 * Author: morgenro 00006 */ 00007 00008 #ifndef RWMUTEX_H_ 00009 #define RWMUTEX_H_ 00010 00011 #include "ibrcommon/thread/Mutex.h" 00012 #include <pthread.h> 00013 00014 namespace ibrcommon 00015 { 00016 class RWMutex 00017 { 00018 public: 00019 enum LockState { 00020 LOCK_READONLY = 0, 00021 LOCK_READWRITE = 1 00022 }; 00023 00024 RWMutex(); 00025 virtual ~RWMutex(); 00026 00027 virtual void trylock(LockState state) throw (MutexException); 00028 virtual void enter(LockState state) throw (MutexException); 00029 virtual void leave() throw (MutexException); 00030 00031 protected: 00032 pthread_rwlock_t _rwlock; 00033 //pthread_mutexattr_t m_attr; 00034 }; 00035 } /* namespace ibrcommon */ 00036 #endif /* RWMUTEX_H_ */