public class Semaphore
Asynchronous Semaphore.
| Constructor and Description |
|---|
Semaphore(int limit)
Asynchronous Semaphore.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
enter(kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Enters the semaphore.
|
int |
getLimit()
is the semaphores permits count limit
|
void |
leave()
Exits the semaphore.
|
public Semaphore(int limit)
Asynchronous Semaphore.
limit - is the semaphores permits count limitpublic java.lang.Object enter(kotlin.coroutines.experimental.Continuation<? super kotlin.Unit> p)
Enters the semaphore.
If the number of permits didn't reach limit, this function will return immediately.
If the limit is reached, it will wait until Semaphore.leave is call from other coroutine.
Semaphore.leavepublic void leave()
Exits the semaphore.
If limit was reached, this will potentially resume
suspended coroutines that invoked the Semaphore.enter method.
Semaphore.enterpublic int getLimit()
is the semaphores permits count limit