diff options
Diffstat (limited to 'dep/src/zthread/posix')
-rw-r--r-- | dep/src/zthread/posix/ConditionRecursiveLock.h | 36 | ||||
-rw-r--r-- | dep/src/zthread/posix/FastLock.h | 26 | ||||
-rw-r--r-- | dep/src/zthread/posix/FtimeStrategy.h | 4 | ||||
-rw-r--r-- | dep/src/zthread/posix/Monitor.h | 18 | ||||
-rw-r--r-- | dep/src/zthread/posix/PriorityOps.h | 6 | ||||
-rw-r--r-- | dep/src/zthread/posix/TSS.h | 24 | ||||
-rw-r--r-- | dep/src/zthread/posix/ThreadOps.h | 24 |
7 files changed, 69 insertions, 69 deletions
diff --git a/dep/src/zthread/posix/ConditionRecursiveLock.h b/dep/src/zthread/posix/ConditionRecursiveLock.h index a46ed35548c..2be55c13797 100644 --- a/dep/src/zthread/posix/ConditionRecursiveLock.h +++ b/dep/src/zthread/posix/ConditionRecursiveLock.h @@ -38,13 +38,13 @@ namespace ZThread { * @version 2.2.0 * * This is an implementation of a FastRecursiveLock for any vannila - * POSIX system. It is based on a condition variable and a mutex; + * POSIX system. It is based on a condition variable and a mutex; * because of this it is important to not that its waiting properties * are not the same as other mutex implementations that generally * based on spin locks. Under high contention, this implementation may * be preferable to a spin lock, although refactoring the design of * code that puts a mutex under alot of preasure may be worth investigating. - */ + */ class FastRecursiveLock : private NonCopyable { //! Serialize state @@ -62,25 +62,25 @@ class FastRecursiveLock : private NonCopyable { public: inline FastRecursiveLock() : _owner(0), _count(0) { - + pthread_mutex_init(&_mtx, 0); if(pthread_cond_init(&_cond, 0) != 0) { assert(0); } } - + inline ~FastRecursiveLock() { pthread_mutex_destroy(&_mtx); if(pthread_cond_destroy(&_cond) != 0) { - assert(0); + assert(0); } - + } - + inline void acquire() { - + pthread_t self = pthread_self(); pthread_mutex_lock(&_mtx); @@ -91,14 +91,14 @@ public: do { // ignore signals status = pthread_cond_wait(&_cond, &_mtx); } while(status == EINTR && _owner == 0); - + } - + _owner = self; _count++; pthread_mutex_unlock(&_mtx); - + } inline bool tryAcquire(unsigned long timeout=0) { @@ -109,10 +109,10 @@ public: // If the caller owns the lock, or there is no owner update the count bool success = (_owner == 0 || pthread_equal(_owner, self)); if(success) { - + _owner = self; _count++; - + } pthread_mutex_unlock(&_mtx); @@ -122,7 +122,7 @@ public: } inline void release() { - + assert(pthread_equal(_owner, pthread_self())); pthread_mutex_lock(&_mtx); @@ -134,13 +134,13 @@ public: } pthread_mutex_unlock(&_mtx); - + } - - + + }; /* FastRecursiveLock */ -} // namespace ZThread +} // namespace ZThread #endif diff --git a/dep/src/zthread/posix/FastLock.h b/dep/src/zthread/posix/FastLock.h index 87faf34d4ff..261fd7c893a 100644 --- a/dep/src/zthread/posix/FastLock.h +++ b/dep/src/zthread/posix/FastLock.h @@ -39,16 +39,16 @@ namespace ZThread { * * This is the smallest and fastest synchronization object in the library. * It is an implementation of fast mutex, an all or nothing exclusive - * lock. It should be used only where you need speed and are willing + * lock. It should be used only where you need speed and are willing * to sacrifice all the state & safety checking provided by the framework * for speed. - */ + */ class FastLock : private NonCopyable { - + pthread_mutex_t _mtx; public: - + /** * Create a new FastLock. No safety or state checks are performed. * @@ -60,7 +60,7 @@ class FastLock : private NonCopyable { throw Initialization_Exception(); } - + /** * Destroy a FastLock. No safety or state checks are performed. */ @@ -71,14 +71,14 @@ class FastLock : private NonCopyable { } } - + /** * Acquire an exclusive lock. No safety or state checks are performed. * * @exception Synchronization_Exception - not thrown */ inline void acquire() { - + if(pthread_mutex_lock(&_mtx) != 0) throw Synchronization_Exception(); @@ -97,22 +97,22 @@ class FastLock : private NonCopyable { return (pthread_mutex_trylock(&_mtx) == 0); } - + /** * Release an exclusive lock. No safety or state checks are performed. - * The caller should have already acquired the lock, and release it + * The caller should have already acquired the lock, and release it * only once. - * + * * @exception Synchronization_Exception - not thrown */ inline void release() { - + if(pthread_mutex_unlock(&_mtx) != 0) throw Synchronization_Exception(); } - - + + }; /* FastLock */ diff --git a/dep/src/zthread/posix/FtimeStrategy.h b/dep/src/zthread/posix/FtimeStrategy.h index 5e703970c5c..5e8d33b6c9b 100644 --- a/dep/src/zthread/posix/FtimeStrategy.h +++ b/dep/src/zthread/posix/FtimeStrategy.h @@ -55,8 +55,8 @@ public: return (unsigned long)_value.time; } - inline unsigned long milliseconds() const { - return _value.millitm; + inline unsigned long milliseconds() const { + return _value.millitm; } unsigned long seconds(unsigned long s) { diff --git a/dep/src/zthread/posix/Monitor.h b/dep/src/zthread/posix/Monitor.h index 945c879f421..fe6c8b559e3 100644 --- a/dep/src/zthread/posix/Monitor.h +++ b/dep/src/zthread/posix/Monitor.h @@ -50,7 +50,7 @@ class Monitor : public Status, private NonCopyable { pthread_t _owner; //! Waiting flag, to avoid uneccessary signals - volatile bool _waiting; + volatile bool _waiting; public: @@ -62,12 +62,12 @@ class Monitor : public Status, private NonCopyable { //! Destroy the monitor. ~Monitor(); - //! Acquire the lock for this monitor. + //! Acquire the lock for this monitor. inline void acquire() { _lock.acquire(); } - //! Acquire the lock for this monitor. + //! Acquire the lock for this monitor. inline bool tryAcquire() { return _lock.tryAcquire(); } @@ -79,7 +79,7 @@ class Monitor : public Status, private NonCopyable { /** * Wait for a state change and atomically unlock the external lock. - * Blocks for an indefinent amount of time. + * Blocks for an indefinent amount of time. * * @return INTERRUPTED if the wait was ended by a interrupt() * or SIGNALED if the wait was ended by a notify() @@ -92,11 +92,11 @@ class Monitor : public Status, private NonCopyable { /** * Wait for a state change and atomically unlock the external lock. - * May blocks for an indefinent amount of time. + * May blocks for an indefinent amount of time. * * @param timeout - maximum time to block (milliseconds) or 0 to * block indefinently - * + * * @return INTERRUPTED if the wait was ended by a interrupt() * or TIMEDOUT if the maximum wait time expired. * or SIGNALED if the wait was ended by a notify() @@ -116,9 +116,9 @@ class Monitor : public Status, private NonCopyable { /** * Notify this monitor. If there is a thread blocked on this monitor object - * it will be signaled and released. If there is no waiter, a flag is set and - * the next attempt to wait() will return SIGNALED w/o blocking, if no other - * flag is set. + * it will be signaled and released. If there is no waiter, a flag is set and + * the next attempt to wait() will return SIGNALED w/o blocking, if no other + * flag is set. * * @return false if the thread was previously INTERRUPTED. */ diff --git a/dep/src/zthread/posix/PriorityOps.h b/dep/src/zthread/posix/PriorityOps.h index 92da66a9cff..3a7f822711d 100644 --- a/dep/src/zthread/posix/PriorityOps.h +++ b/dep/src/zthread/posix/PriorityOps.h @@ -34,15 +34,15 @@ namespace ZThread { * @date <2003-07-16T23:30:00-0400> * @version 2.2.0 * - * This class is an abstraction used to perform various operations on a + * This class is an abstraction used to perform various operations on a * native POSIX thread. */ class PriorityOps { - + public: - + }; diff --git a/dep/src/zthread/posix/TSS.h b/dep/src/zthread/posix/TSS.h index 931ff348b3d..c9c9c0e352a 100644 --- a/dep/src/zthread/posix/TSS.h +++ b/dep/src/zthread/posix/TSS.h @@ -35,18 +35,18 @@ namespace ZThread { * @date <2003-07-27T14:18:37-0400> * @version 2.3.0 * - * An abstraction for dealing with POSIX thread specific storage (tss). + * An abstraction for dealing with POSIX thread specific storage (tss). * Provides get/set and creation/destruction. */ template <typename T> class TSS : private NonCopyable { - + pthread_key_t _key; public: /** - * Create a new object for accessing tss. + * Create a new object for accessing tss. */ TSS() { @@ -57,15 +57,15 @@ namespace ZThread { } /** - * Destroy the underlying supoprt for accessing tss with this + * Destroy the underlying supoprt for accessing tss with this * object. */ ~TSS() { - + pthread_key_delete(_key); - + } - + /** * Get the value stored in tss. * @@ -76,8 +76,8 @@ namespace ZThread { T get() const { return reinterpret_cast<T>(pthread_getspecific(_key)); } - - + + /** * Store a value in tss. * @@ -90,11 +90,11 @@ namespace ZThread { T oldValue = get(); pthread_setspecific(_key, value); - + return oldValue; - + } - + }; } diff --git a/dep/src/zthread/posix/ThreadOps.h b/dep/src/zthread/posix/ThreadOps.h index be754c2d659..8fef43bb3fd 100644 --- a/dep/src/zthread/posix/ThreadOps.h +++ b/dep/src/zthread/posix/ThreadOps.h @@ -31,7 +31,7 @@ namespace ZThread { class Runnable; - + //! Dispatch function for native pthreads required extern C //! linkage. extern "C" void* _dispatch(void*); @@ -42,7 +42,7 @@ extern "C" void* _dispatch(void*); * @date <2003-07-16T23:30:25-0400> * @version 2.2.8 * - * This class is an abstraction used to perform various operations on a + * This class is an abstraction used to perform various operations on a * native POSIX thread. */ class ThreadOps { @@ -54,10 +54,10 @@ class ThreadOps { public: - const static ThreadOps INVALID; + const static ThreadOps INVALID; /** - * Create a new ThreadOps to manipulate a native thread. + * Create a new ThreadOps to manipulate a native thread. */ ThreadOps() : _tid(0) { } @@ -66,26 +66,26 @@ public: return pthread_equal(_tid, ops._tid); } - + static ThreadOps self() { return ThreadOps(pthread_self()); } /** - * Activating an instance of ThreadOps will map it onto the currently + * Activating an instance of ThreadOps will map it onto the currently * executing thread. - */ + */ static void activate(ThreadOps* ops) { assert(ops); assert(ops->_tid == 0); ops->_tid = pthread_self(); - + } /** - * Test if this object represents the currently executing + * Test if this object represents the currently executing * native thread. * * @return bool true if successful @@ -107,7 +107,7 @@ public: static bool join(ThreadOps*); /** - * Force the current native thread to yield, letting the scheduler + * Force the current native thread to yield, letting the scheduler * give the CPU time to another thread. * * @return bool true if successful, false if the operation can't @@ -116,7 +116,7 @@ public: static bool yield(); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param PRIORITY requested priority @@ -125,7 +125,7 @@ public: static bool setPriority(ThreadOps*, Priority); /** - * Set the priority for the native thread if supported by the + * Set the priority for the native thread if supported by the * system. * * @param Thread::PRIORITY& current priority |