ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/Semaphore.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/Semaphore.java (file contents):
Revision 1.3 by dl, Fri Jun 6 18:42:17 2003 UTC vs.
Revision 1.4 by dl, Tue Jun 24 14:34:49 2003 UTC

# Line 95 | Line 95 | package java.util.concurrent;
95   * @spec JSR-166
96   * @revised $Date$
97   * @editor $Author$
98 + * @author Doug Lea
99   *
100   */
101   public class Semaphore implements java.io.Serializable {
# Line 108 | Line 109 | public class Semaphore implements java.i
109      final Condition available;
110      long count;
111  
112 +    /**
113 +     * Package-private constructor used by FairSemaphore
114 +     * @param permits the initial number of permits available
115 +     * @param lock the lock to use
116 +     */
117      Semaphore(long permits, ReentrantLock lock) {
118          this.count = permits;
119          this.lock = lock;
# Line 156 | Line 162 | public class Semaphore implements java.i
162      public void acquire() throws InterruptedException {
163          lock.lockInterruptibly();
164          try {
165 <            while (count <= 0) available.await();
165 >            while (count <= 0)
166 >                available.await();
167              --count;
168          }
169          catch (InterruptedException ie) {
# Line 191 | Line 198 | public class Semaphore implements java.i
198      public void acquireUninterruptibly() {
199          lock.lock();
200          try {
201 <            while (count <= 0) available.awaitUninterruptibly();
201 >            while (count <= 0)
202 >                available.awaitUninterruptibly();
203              --count;
204          }
205          finally {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines