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.64 by jsr166, Sun Nov 18 18:03:11 2012 UTC vs.
Revision 1.65 by dl, Tue Dec 23 11:58:00 2014 UTC

# Line 112 | Line 112 | import java.util.concurrent.locks.Abstra
112   *
113   * <p>This class also provides convenience methods to {@link
114   * #acquire(int) acquire} and {@link #release(int) release} multiple
115 < * permits at a time.  Beware of the increased risk of indefinite
116 < * postponement when these methods are used without fairness set true.
115 > * permits at a time. These methods are generally more efficient and
116 > * effective than loops. However, they do not establish any preference
117 > * order. For example, if thread A invokes @code{s.acquire(3}) and
118 > * thread B invokes @code{s.acquire(2)}, and two permits become
119 > * available, then there is no guarantee that thread B will obtain
120 > * them unless its acquire came first and Semaphore @code{s} is in
121 > * fair mode.
122   *
123   * <p>Memory consistency effects: Actions in a thread prior to calling
124   * a "release" method such as {@code release()}
# Line 411 | Line 416 | public class Semaphore implements java.i
416       * one of two things happens:
417       * <ul>
418       * <li>Some other thread invokes one of the {@link #release() release}
419 <     * methods for this semaphore, the current thread is next to be assigned
419 >     * methods for this semaphore, and the current thread is next to be assigned
420       * permits and the number of available permits satisfies this request; or
421       * <li>Some other thread {@linkplain Thread#interrupt interrupts}
422       * the current thread.
# Line 558 | Line 563 | public class Semaphore implements java.i
563       *
564       * <p>Releases the given number of permits, increasing the number of
565       * available permits by that amount.
566 <     * If any threads are trying to acquire permits, then one
566 >     * If any threads are trying to acquire permits, then one thread
567       * is selected and given the permits that were just released.
568       * If the number of available permits satisfies that thread's request
569       * then that thread is (re)enabled for thread scheduling purposes;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines