-
Notifications
You must be signed in to change notification settings - Fork 7
timed_semaphore try_acquire_for
Alairion edited this page May 8, 2021
·
4 revisions
nes::timed_semaphore::try_acquire_for
template<typename Rep, typename Period>
(1) bool try_acquire_for(const std::chrono::duration<Rep, Period>& timeout);
- Checks if a resource is available within a certain delay, and if that is the case decrements the resource counter.
Name | Description |
---|---|
timeout |
The maximum duration to wait for. Note that it is just a request and the implementation can wait for more than the specified time, especially for value smaller than 1 millisecond. |
- Returns
true
if the resource counter was successfully decremented, returnsfalse
otherwise.
- May throw an exception depending on the implementation behaviour.
- On Windows, calls
WaitForSingleObject
On Posix systems, callssem_timedwait