- permits
- the number of permits to acquire
- timeout
- the maximum time to wait for the permits
- unit
- the time unit of the timeout argument
Documentation for this section has not yet been entered.
Type Reason Java.Lang.InterruptedException if the current thread is interrupted Java.Lang.IllegalArgumentException if permits is negative
Acquires the given number of permits from this semaphore, if all become available within the given waiting time and the current thread has not been Java.Lang.Thread.Interrupt.
Acquires the given number of permits, if they are available and returns immediately, with the value true, reducing the number of available permits by the given amount.
If insufficient permits are available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of three things happens:
If the permits are acquired then the value true is returned.
If the current thread:
If the specified waiting time elapses then the value false is returned. If the time is less than or equal to zero, the method will not wait at all. Any permits that were to be assigned to this thread, are instead assigned to other threads trying to acquire permits, as if the permits had been made available by a call to Semaphore.Release.