diff options
Diffstat (limited to 'nci/jni/SyncEvent.h')
-rw-r--r-- | nci/jni/SyncEvent.h | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/nci/jni/SyncEvent.h b/nci/jni/SyncEvent.h index 5828569..5ab5d43 100644 --- a/nci/jni/SyncEvent.h +++ b/nci/jni/SyncEvent.h @@ -19,25 +19,25 @@ class SyncEvent public: /******************************************************************************* ** - ** Function: ~SyncEvent + ** Function: ~SyncEvent ** ** Description: Cleanup all resources. - ** + ** ** Returns: None. ** *******************************************************************************/ - ~SyncEvent () + ~SyncEvent () { - mMutex.unlock (); + mMutex.unlock (); } - + /******************************************************************************* ** ** Function: start ** - ** Description: Start a synchronization operation. - ** + ** Description: Start a synchronization operation. + ** ** Returns: None. ** *******************************************************************************/ @@ -46,71 +46,71 @@ public: mMutex.lock (); } - + /******************************************************************************* ** ** Function: wait ** ** Description: Block the thread and wait for the event to occur. - ** + ** ** Returns: None. ** *******************************************************************************/ void wait () - { + { mCondVar.wait (mMutex); end (); } - + /******************************************************************************* ** ** Function: wait ** ** Description: Block the thread and wait for the event to occur. ** millisec: Timeout in milliseconds. - ** + ** ** Returns: True if wait is successful; false if timeout occurs. ** *******************************************************************************/ bool wait (long millisec) - { + { bool retVal = mCondVar.wait (mMutex, millisec); end (); return retVal; } - + /******************************************************************************* ** - ** Function: notifyOne + ** Function: notifyOne + ** + ** Description: Notify a blocked thread that the event has occured. Unblocks it. ** - ** Description: Notify a blocked thread that the event has occured. Unblocks it. - ** ** Returns: None. ** *******************************************************************************/ - void notifyOne () - { - mCondVar.notifyOne (); + void notifyOne () + { + mCondVar.notifyOne (); end (); } - + /******************************************************************************* ** - ** Function: end + ** Function: end + ** + ** Description: End a synchronization operation. ** - ** Description: End a synchronization operation. - ** ** Returns: None. ** *******************************************************************************/ - void end () - { + void end () + { mMutex.unlock (); } - + private: CondVar mCondVar; Mutex mMutex; @@ -133,10 +133,10 @@ class SyncEventGuard public: /******************************************************************************* ** - ** Function: SyncEventGuard + ** Function: SyncEventGuard ** ** Description: Start a synchronization operation. - ** + ** ** Returns: None. ** *******************************************************************************/ @@ -145,14 +145,14 @@ public: { event.start (); //automatically start operation }; - + /******************************************************************************* ** - ** Function: ~SyncEventGuard + ** Function: ~SyncEventGuard ** ** Description: End a synchronization operation. - ** + ** ** Returns: None. ** *******************************************************************************/ @@ -160,7 +160,7 @@ public: { mEvent.end (); //automatically end operation }; - + private: SyncEvent& mEvent; }; |