summaryrefslogtreecommitdiff
path: root/java/src/IceUtil/CountDownLatch.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2004-04-17 22:49:39 +0000
committerBernard Normier <bernard@zeroc.com>2004-04-17 22:49:39 +0000
commitd8dfbcdfeaad50c560f175788d22e630a047873d (patch)
tree6ac047ba22895f4800b2f254dfcbcd9b962957fb /java/src/IceUtil/CountDownLatch.java
parentFreeze facet update (diff)
downloadice-d8dfbcdfeaad50c560f175788d22e630a047873d.tar.bz2
ice-d8dfbcdfeaad50c560f175788d22e630a047873d.tar.xz
ice-d8dfbcdfeaad50c560f175788d22e630a047873d.zip
Implemented IceUtil.Cache properly
Diffstat (limited to 'java/src/IceUtil/CountDownLatch.java')
-rw-r--r--java/src/IceUtil/CountDownLatch.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/java/src/IceUtil/CountDownLatch.java b/java/src/IceUtil/CountDownLatch.java
new file mode 100644
index 00000000000..88e6719a102
--- /dev/null
+++ b/java/src/IceUtil/CountDownLatch.java
@@ -0,0 +1,56 @@
+// **********************************************************************
+//
+// Copyright (c) 2004
+// ZeroC, Inc.
+// Billerica, MA, USA
+//
+// All Rights Reserved.
+//
+// Ice is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation.
+//
+// **********************************************************************
+
+package IceUtil;
+
+//
+// See java.util.CountDownLatch in Java 1.5
+//
+
+public class CountDownLatch
+{
+ public CountDownLatch(int count)
+ {
+ if(_count < 0)
+ {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public synchronized void
+ await() throws InterruptedException
+ {
+ while(_count > 0)
+ {
+ wait();
+ }
+ }
+
+ public synchronized void
+ countDown()
+ {
+ if(--_count == 0)
+ {
+ notifyAll();
+ }
+ }
+
+ public synchronized long
+ getCount()
+ {
+ return _count;
+ }
+
+ private long _count;
+}