// local counting semaphore localCountingSem->Decrement(); // global counting semaphore globalCountingSemaphore->Decrement();
Decrement(). If this period expires before the decrement operation completes, Decrement() throws a TTimeOutException with an error value of kTimeExpired.
Alternatively, you can use the TryDecrement() member function to attempt to decrement the semaphore without blocking. If the semaphore's count is greater than zero, TryDecrement() decrements the count and returns true. Otherwise, TryDecrement() immediately returns false.