class SemaphoreExtensions extends Object
Extension methods for the Semaphore concurrency utility.
| Constructor and description |
|---|
SemaphoreExtensions() |
| Type Params | Return Type | Name and description |
|---|---|---|
<T> |
static T |
acquireAndRelease(Semaphore self, Closure<T> closure)Acquire and release a single permit around the given closure. |
<T> |
static T |
tryAcquireAndRelease(Semaphore self, Closure<T> closure)Using Semaphore.tryAcquire, execute the closure and release the semaphore if tryAcquire returned true. |
Acquire and release a single permit around the given closure. @return
Using Semaphore.tryAcquire, execute the closure and release the
semaphore if tryAcquire returned true.
tryAcquire returns
true, otherwise null.