diff options
author | Paradox <none@none> | 2009-02-09 08:16:34 -0500 |
---|---|---|
committer | Paradox <none@none> | 2009-02-09 08:16:34 -0500 |
commit | d230302b16474ff22a35243ffed6236ef4fc7fb9 (patch) | |
tree | e3679ad841a47b275756f2721f9aa24a3ee548a6 /dep/src/zthread/vanilla/SimpleRecursiveLock.h | |
parent | b0694d7e5e794b361fa178d55fefdb98cf47e9ca (diff) |
Replace tabs with spaces in more files.
--HG--
branch : trunk
Diffstat (limited to 'dep/src/zthread/vanilla/SimpleRecursiveLock.h')
-rw-r--r-- | dep/src/zthread/vanilla/SimpleRecursiveLock.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/dep/src/zthread/vanilla/SimpleRecursiveLock.h b/dep/src/zthread/vanilla/SimpleRecursiveLock.h index f4f309218b6..6adf4154fc4 100644 --- a/dep/src/zthread/vanilla/SimpleRecursiveLock.h +++ b/dep/src/zthread/vanilla/SimpleRecursiveLock.h @@ -37,49 +37,49 @@ namespace ZThread { * @version 2.2.8 * * This implementation of a FastRecursiveLock uses the which ever FastLock - * that is selected to create a recursive spin lock. - */ + * that is selected to create a recursive spin lock. + */ class FastRecursiveLock : private NonCopyable { - + FastLock _lock; ThreadOps _owner; volatile unsigned int _count; - + public: - + inline FastRecursiveLock() : _owner(ThreadOps::INVALID), _count(0) {} - + inline ~FastRecursiveLock() { assert(_owner == ThreadOps::INVALID); assert(_count == 0); } - + inline void acquire() { ThreadOps self(ThreadOps::self()); bool wasLocked = false; do { - + _lock.acquire(); - + // If there is no owner, or the owner is the caller // update the count if(_owner == ThreadOps::INVALID || _owner == self) { _owner = self; _count++; - + wasLocked = true; - + } _lock.release(); - + } while(!wasLocked); assert(_owner == ThreadOps::self()); @@ -96,32 +96,32 @@ public: _owner = ThreadOps::INVALID; _lock.release(); - + } - + inline bool tryAcquire(unsigned long timeout=0) { ThreadOps self(ThreadOps::self()); bool wasLocked = false; _lock.acquire(); - + if(_owner == ThreadOps::INVALID || _owner == self) { - + _owner = self; _count++; - + wasLocked = true; } - + _lock.release(); assert(!wasLocked || _owner == ThreadOps::self()); - return wasLocked; - + return wasLocked; + } - + }; /* FastRecursiveLock */ |