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

Comparing jsr166/src/main/java/util/concurrent/FairSemaphore.java (file contents):
Revision 1.3 by dl, Tue Jun 24 14:34:48 2003 UTC vs.
Revision 1.4 by dl, Tue Jul 8 00:46:33 2003 UTC

# Line 5 | Line 5
5   */
6  
7   package java.util.concurrent;
8 + import java.util.concurrent.locks.*;
9  
10   /**
11   * A semaphore guaranteeing that threads invoking any of the {@link
# Line 30 | Line 31 | package java.util.concurrent;
31   public class FairSemaphore extends Semaphore {
32  
33      /*
34 <     * This differs from Semaphore only in that it uses a
35 <     * FairReentrantLock.  Because the FairReentrantLock guarantees
36 <     * FIFO queuing, we don't need to do anything fancy to prevent
34 >     * This differs from Semaphore only in that it uses a Fair
35 >     * ReentrantLock.  Because the Fair ReentrantLock guarantees FIFO
36 >     * queuing, we don't need to do anything fancy to prevent
37       * overtaking etc.  for the multiple-permit methods. The only
38       * minor downside is that multi-permit acquires will sometimes
39       * repeatedly wake up finding that they must re-wait. A custom
# Line 46 | Line 47 | public class FairSemaphore extends Semap
47       * @param permits the initial number of permits available
48       */
49      public FairSemaphore(long permits) {
50 <        super(permits, new FairReentrantLock());
50 >        super(permits, new ReentrantLock(true));
51      }
52  
53      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines