114 |
|
* #acquire(int) acquire} and {@link #release(int) release} multiple |
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 |
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 |
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 |
410 |
|
* <p>Acquires the given number of permits, if they are available, |
411 |
|
* and returns immediately, reducing the number of available permits |
412 |
|
* by the given amount. This method has the same effect as the |
413 |
< |
* loop @code{for (int i = 0; i < permits; ++i) acquire();} except |
413 |
> |
* loop {@code for (int i = 0; i < permits; ++i) acquire();} except |
414 |
|
* that it atomically acquires the permits all at once: |
415 |
|
* |
416 |
|
* <p>If insufficient permits are available then the current thread becomes |
452 |
|
* <p>Acquires the given number of permits, if they are available, |
453 |
|
* and returns immediately, reducing the number of available permits |
454 |
|
* by the given amount.This method has the same effect as the |
455 |
< |
* loop @code{for (int i = 0; i < permits; ++i) acquireUninterruptibly();} |
455 |
> |
* loop {@code for (int i = 0; i < permits; ++i) acquireUninterruptibly();} |
456 |
|
* except that it atomically acquires the permits all at once: |
457 |
|
* |
458 |
|
* <p>If insufficient permits are available then the current thread becomes |