Acquires the given number of permits if they are available, and returns immediately, 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: some other thread
invokes one of the methods for this semaphore, the current thread is next to be assigned permits and the number
of available permits satisfies this request, this ISemaphore instance is destroyed, or some other thread
the current thread. If the current thread has its interrupted status set on entry to this method, or is while
waiting for a permit, then is thrown and the current thread's interrupted status is cleared.
Releases the given number of permits, increasing the number of available permits by that amount. There is no
requirement that a thread that releases a permit must have acquired that permit by calling one of the
acquire()acquire methods. Correct usage of a semaphore is established by programming convention in the application.
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 this
method will return immediately with the value false and the number of available permits is unchanged.
name - Name of the Semaphore
permits - The number of permits to remove
timeout - The maximum time to wait for a permit
true if all permits were acquired, false if the waiting time elapsed before all permits could be acquired