diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-01-01 08:00:34 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-01-01 08:00:34 +0000 |
commit | 437eea6fa08e931864f89be91d14a816f69075c7 (patch) | |
tree | b8c1fd723fdcd61c3855d3a3a21a9cd45a268219 /java/src/Condition.java | |
parent | ea0d28240863caf437a18071bfd03e7b146c5ade (diff) | |
download | ATCD-unlabeled-4.2.2.tar.gz |
This commit was manufactured by cvs2svn to create branchunlabeled-4.2.2
'unlabeled-4.2.2'.
Diffstat (limited to 'java/src/Condition.java')
-rw-r--r-- | java/src/Condition.java | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/java/src/Condition.java b/java/src/Condition.java deleted file mode 100644 index 17acf228346..00000000000 --- a/java/src/Condition.java +++ /dev/null @@ -1,124 +0,0 @@ -/************************************************* - * - * = PACKAGE - * ACE.Concurrency - * - * = FILENAME - * Condition.java - * - *@author Irfan Pyarali - * - *************************************************/ -package ACE.Concurrency; - -import ACE.ASX.TimeoutException; -import ACE.ASX.TimeValue; - -/** - * <hr> - * <h2>TITLE</h2> - *<blockquote> - * Abstraction for <em>traditional</em> - * condition variable - *</blockquote> - * - * <h2>DESCRIPTION</h2> - *<blockquote> - * This condition variable allows the use of one - * mutex between multiple conditions. - * This implementation is based on the C++ version of ACE. - *</blockquote> - */ -public class Condition -{ - /** - * Default constructor - *@param Mutex for synchronization - */ - public Condition (Mutex mutex) - { - mutex_ = mutex; - } - - /** - * Wait for condition to become signaled. - *@exception InterruptedException exception during wait - */ - public void Wait () - throws InterruptedException - { - waiters_++; - - try - { - mutex_.release(); - semaphore_.acquire (); - mutex_.acquire (); - } - finally - { - waiters_--; - } - } - - /** - * TimedWait for condition to become signaled. - *@exception TimeoutException wait timed out exception - *@exception InterruptedException exception during wait - */ - public void Wait (TimeValue tv) - throws TimeoutException, InterruptedException - { - waiters_++; - - try - { - mutex_.release(); - - TimeValue start = TimeValue.getTimeOfDay (); - - semaphore_.acquire (tv); - - TimeValue now = TimeValue.getTimeOfDay (); - tv.minusEquals (TimeValue.minus (now, start)); - - mutex_.acquire (tv); - } - finally - { - waiters_--; - } - } - - /** - * Signal condition. Wake one waiter (if any). - */ - public void signal () - { - if (waiters_ > 0) - semaphore_.release (); - } - - /** - * Signal condition. Wake up all waiters (if any). - */ - public void broadcast () - { - for (int i = waiters_; i > 0; i--) - semaphore_.release (); - } - - /** - * Accessor to lock - *@return Mutex - */ - public Mutex mutex () - { - return mutex_; - } - - private int waiters_; - private Semaphore semaphore_ = new Semaphore (0); - private Mutex mutex_; - -} |