- permits
- the number of permits to release
Type Reason Java.Lang.IllegalArgumentException if permits is negative
Releases the given number of permits, returning them to the semaphore.
Releases the given number of permits, increasing the number of available permits by that amount. If any threads are trying to acquire permits, then one is selected and given the permits that were just released. If the number of available permits satisfies that thread's request then that thread is (re)enabled for thread scheduling purposes; otherwise the thread will wait until sufficient permits are available. If there are still permits available after this thread's request has been satisfied, then those permits are assigned in turn to other threads trying to acquire permits.
There is no requirement that a thread that releases a permit must have acquired that permit by calling Semaphore.Acquire. Correct usage of a semaphore is established by programming convention in the application.