00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LIBMUTH_DUMMYLOCK_H
00020 #define LIBMUTH_DUMMYLOCK_H
00021
00022 #ifdef USE_PTHREAD
00023 #error this file must be compiled without -DUSE_PTHREAD
00024 #endif
00025
00026 #include <assert.h>
00027
00031 class DummyLock {
00032 private:
00033 bool locked;
00034 public:
00038 inline DummyLock() throw() : locked(false) {}
00044 inline void acquire() throw() {
00045 assert(this->locked == false);
00046 this->locked = true;
00047 }
00052 inline bool tryacquire() throw() {
00053 if(this->locked)
00054 return false;
00055 this->locked = true;
00056 return true;
00057 }
00062 inline void release() throw() {
00063 assert(this->locked == true);
00064 this->locked = false;
00065 }
00069 inline ~DummyLock() throw() { assert(this->locked == false); }
00070 };
00071
00072 #endif