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.19 by dl, Mon Nov 10 17:31:23 2003 UTC vs.
Revision 1.20 by dl, Tue Dec 23 19:38:09 2003 UTC

# Line 122 | Line 122 | public class Semaphore implements java.i
122      /*
123       * The underlying algorithm here is a simplified adaptation of
124       * that used for ReentrantLock. See the internal documentation of
125 <     * ReentrantLock for detailed explanation.
125 >     * lock package classes for detailed explanation.
126       */
127  
128      private static final long serialVersionUID = -3222578661600680210L;
# Line 219 | Line 219 | public class Semaphore implements java.i
219       * @return remaining number of permits
220       */
221      private int doTryAcquire(int permits) {
222 +        final AtomicInteger perms = this.perms;
223          for (;;) {
224              int available = perms.get();
225              int remaining = available - permits;
# Line 347 | Line 348 | public class Semaphore implements java.i
348       * Internal version of release
349       */
350      private void doRelease(int permits) {
351 +        final AtomicInteger perms = this.perms;
352          for (;;) {
353              int p = perms.get();
354              if (perms.compareAndSet(p, p + permits)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines