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.25 by dl, Sun Dec 28 15:53:16 2003 UTC vs.
Revision 1.26 by dl, Mon Dec 29 14:19:17 2003 UTC

# Line 133 | Line 133 | public class Semaphore implements java.i
133              state().set(permits);
134          }
135          
136 <        public final int acquireSharedState(boolean isQueued, int acquires,
137 <                                            Thread current) {
136 >        public int acquireSharedState(boolean isQueued, int acquires) {
137              final AtomicInteger perms = state();
138              if (!isQueued && fair && hasQueuedThreads())
139                  return -1;
# Line 147 | Line 146 | public class Semaphore implements java.i
146              }
147          }
148          
149 <        public final boolean releaseSharedState(int releases) {
149 >        public boolean releaseSharedState(int releases) {
150              final AtomicInteger perms = state();
151              for (;;) {
152                  int p = perms.get();
# Line 156 | Line 155 | public class Semaphore implements java.i
155              }
156          }
157          
158 <        public final int acquireExclusiveState(boolean isQueued,
160 <                                               int acquires,
161 <                                               Thread current) {
158 >        public int acquireExclusiveState(boolean isQueued, int acquires) {
159              throw new UnsupportedOperationException();
160          }
161          
# Line 254 | Line 251 | public class Semaphore implements java.i
251       * otherwise.
252       */
253      public boolean tryAcquire() {
254 <        return sync.acquireSharedState(false, 1, null) >= 0;
254 >        return sync.acquireSharedState(false, 1) >= 0;
255      }
256  
257      /**
# Line 411 | Line 408 | public class Semaphore implements java.i
408       */
409      public boolean tryAcquire(int permits) {
410          if (permits < 0) throw new IllegalArgumentException();
411 <        return sync.acquireSharedState(false, permits, null) >= 0;
411 >        return sync.acquireSharedState(false, permits) >= 0;
412      }
413  
414      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines