The QSemaphoreReleaser class provides exception-safe deferral of a QSemaphore::release() call.
QSemaphore * cancel() noexcept
Cancels this QSemaphoreReleaser such that the destructor will no longer call {semaphore()->release()}...
void acquire(int n=1)
Tries to acquire n resources guarded by the semaphore.
bool tryAcquire(int n=1)
Tries to acquire n resources guarded by the semaphore and returns true on success.
void release(int n=1)
Releases n resources guarded by the semaphore.
const QSemaphoreReleaser releaser(sem)
[4]