00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _SK_RT_REENTRANTLOCK_H_
00012 #define _SK_RT_REENTRANTLOCK_H_
00013
00014 #include <sk/rt/thread/AbstractLock.h>
00015
00016 namespace sk {
00017 namespace rt {
00018 class ReentrantLock
00019 : public thread::AbstractLock
00020 {
00021 public:
00022 ReentrantLock();
00023 virtual ~ReentrantLock();
00024
00025 bool isLocked() const;
00026 int getCounter() const;
00027
00028
00029 void lock();
00030 bool tryLock();
00031 void unlock();
00032
00033
00034 const sk::util::Class getClass() const;
00035
00036 protected:
00037 void collectInspectInfo(std::ostream& stream) const;
00038
00039 private:
00040 ReentrantLock(const ReentrantLock& other);
00041 ReentrantLock& operator = (const ReentrantLock& other);
00042
00043 void processLocked();
00044 void processUnlocked();
00045
00046 int _counter;
00047 };
00048 }
00049 }
00050
00051 #endif