diff options
Diffstat (limited to 'dep/src/zthread/macos')
-rw-r--r-- | dep/src/zthread/macos/FastLock.h | 40 | ||||
-rw-r--r-- | dep/src/zthread/macos/Monitor.h | 28 | ||||
-rw-r--r-- | dep/src/zthread/macos/TSS.h | 26 | ||||
-rw-r--r-- | dep/src/zthread/macos/ThreadOps.h | 22 | ||||
-rw-r--r-- | dep/src/zthread/macos/UpTimeStrategy.h | 6 |
5 files changed, 61 insertions, 61 deletions
diff --git a/dep/src/zthread/macos/FastLock.h b/dep/src/zthread/macos/FastLock.h index bae5c482903..0bd40e1f2fd 100644 --- a/dep/src/zthread/macos/FastLock.h +++ b/dep/src/zthread/macos/FastLock.h @@ -39,48 +39,48 @@ namespace ZThread { * @date <2003-07-16T23:25:31-0400> * @version 2.1.6 * - */ + */ class FastLock : private NonCopyable { - + MPCriticalRegionID _mtx; public: - + /** * Create a new FastLock. No safety or state checks are performed. * * @exception Initialization_Exception - not thrown */ inline FastLock() { - + // Apple TN1071 static bool init = MPLibraryIsLoaded(); - + if(!init || MPCreateCriticalRegion(&_mtx) != noErr) { assert(0); throw Initialization_Exception(); } } - + /** * Destroy a FastLock. No safety or state checks are performed. */ inline ~FastLock() throw () { OSStatus status = MPDeleteCriticalRegion(_mtx); - if(status != noErr) + if(status != noErr) assert(false); } - + /** * Acquire an exclusive lock. No safety or state checks are performed. * * @exception Synchronization_Exception - not thrown */ inline void acquire() { - + if(MPEnterCriticalRegion(_mtx, kDurationForever) != noErr) throw Synchronization_Exception(); @@ -96,38 +96,38 @@ class FastLock : private NonCopyable { */ inline bool tryAcquire(unsigned long timeout=0) { - OSStatus status = + OSStatus status = MPEnterCriticalRegion(_mtx, kDurationMillisecond * timeout); switch(status) { case kMPTimeoutErr: return false; - + case noErr: return true; - - } - + + } + assert(0); throw Synchronization_Exception(); } - + /** * 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(MPExitCriticalRegion(_mtx) != noErr) throw Synchronization_Exception(); } - - + + }; /* FastLock */ diff --git a/dep/src/zthread/macos/Monitor.h b/dep/src/zthread/macos/Monitor.h index f4312d7b7ee..9fa3c9a5aa2 100644 --- a/dep/src/zthread/macos/Monitor.h +++ b/dep/src/zthread/macos/Monitor.h @@ -49,40 +49,40 @@ class Monitor : public Status, private NonCopyable { MPTaskID _owner; //! Waiting flag, to avoid uneccessary signals - volatile bool _waiting; + volatile bool _waiting; //! Waiting flag, to avoid too many signals - volatile bool _pending; + volatile bool _pending; //! State of the monitor volatile int _state; - + public: - + //! Create a new monitor. Monitor(); //! Destroy the monitor. ~Monitor() throw(); - //! Acquire the external lock for this monitor. + //! Acquire the external lock for this monitor. inline void acquire() { _lock.acquire(); } - //! Try to acquire the external lock for this monitor. + //! Try to acquire the external lock for this monitor. inline bool tryAcquire() { return _lock.tryAcquire(); } - //! Release the external lock for this monitor. + //! Release the external lock for this monitor. inline void release() { _lock.release(); } - + /** * 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() @@ -95,11 +95,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() @@ -119,9 +119,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/macos/TSS.h b/dep/src/zthread/macos/TSS.h index 3f9805d0f7c..1be90c5f278 100644 --- a/dep/src/zthread/macos/TSS.h +++ b/dep/src/zthread/macos/TSS.h @@ -38,7 +38,7 @@ namespace ZThread { * @date <2003-07-27T14:19:10-0400> * @version 2.1.6 * - * 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> @@ -49,13 +49,13 @@ namespace ZThread { public: /** - * Create a new object for accessing tss. + * Create a new object for accessing tss. */ TSS() { // Apple TN1071 static bool init = MPLibraryIsLoaded(); - + if(!init || MPAllocateTaskStorageIndex(&_key) != noErr) { assert(0); throw Initialization_Exception(); @@ -64,17 +64,17 @@ namespace ZThread { } /** - * Destroy the underlying supoprt for accessing tss with this + * Destroy the underlying supoprt for accessing tss with this * object. */ ~TSS() { - + OSStatus status = MPDeallocateTaskStorageIndex(_key); - if(status != noErr) + if(status != noErr) assert(0); } - + /** * Get the value stored in tss. * @@ -85,8 +85,8 @@ namespace ZThread { T get() const { return reinterpret_cast<T>(MPGetTaskStorageValue(_key)); } - - + + /** * Store a value in tss. * @@ -99,18 +99,18 @@ namespace ZThread { T oldValue = get(); - OSStatus status = + OSStatus status = MPSetTaskStorageValue(_key, reinterpret_cast<TaskStorageValue>(value)); - + if(status != noErr) { assert(0); throw Synchronization_Exception(); } return oldValue; - + } - + }; } diff --git a/dep/src/zthread/macos/ThreadOps.h b/dep/src/zthread/macos/ThreadOps.h index c100fcfefe5..5c4eb044e73 100644 --- a/dep/src/zthread/macos/ThreadOps.h +++ b/dep/src/zthread/macos/ThreadOps.h @@ -33,14 +33,14 @@ namespace ZThread { class Runnable; - + /** * @class ThreadOps * @author Eric Crahen <http://www.code-foo.com> * @date <2003-07-16T23:26:01-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 ThreadOps { @@ -55,10 +55,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(); @@ -84,20 +84,20 @@ public: } /** - * 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 = MPCurrentTaskID(); - + } /** - * Test if this object represents the currently executing + * Test if this object represents the currently executing * native thread. * * @return bool true if successful @@ -119,7 +119,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 @@ -128,7 +128,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 @@ -137,7 +137,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 diff --git a/dep/src/zthread/macos/UpTimeStrategy.h b/dep/src/zthread/macos/UpTimeStrategy.h index f2056e14ca2..0f7962d7eca 100644 --- a/dep/src/zthread/macos/UpTimeStrategy.h +++ b/dep/src/zthread/macos/UpTimeStrategy.h @@ -40,7 +40,7 @@ class TimeStrategy { unsigned long _s; public: - + TimeStrategy() { // Get the absolute time in milliseconds relative to the program startup @@ -53,12 +53,12 @@ class TimeStrategy { _ms = now % 1000; } - + inline unsigned long seconds() const { return _s; } - inline unsigned long milliseconds() const { + inline unsigned long milliseconds() const { return _ms; } |