7#include <QtCore/qglobal.h>
8#include <QtCore/qdeadlinetimer.h>
23 QT_CORE_INLINE_SINCE(6, 6)
26#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
27 template <
typename Rep,
typename Period>
34 int available()
const;
38 template <
typename Rep,
typename Period>
41 template <
typename Clock,
typename Duration>
44 return try_acquire_for(tp - Clock::now());
57#if QT_CORE_INLINE_IMPL_SINCE(6, 6)
71 : m_sem(&
sem), m_n(
n) {}
74 : m_sem(
sem), m_n(
n) {}
89 std::swap(m_n,
other.m_n);
97 return std::exchange(m_sem,
nullptr);
The QSemaphoreReleaser class provides exception-safe deferral of a QSemaphore::release() call.
Q_NODISCARD_CTOR QSemaphoreReleaser()=default
Default constructor.
Q_NODISCARD_CTOR QSemaphoreReleaser(QSemaphore *sem, int n=1) noexcept
Constructor.
~QSemaphoreReleaser()
Unless canceled, calls QSemaphore::release() with the arguments provided to the constructor,...
Q_NODISCARD_CTOR QSemaphoreReleaser(QSemaphoreReleaser &&other) noexcept
Move constructor.
QSemaphore * cancel() noexcept
Cancels this QSemaphoreReleaser such that the destructor will no longer call {semaphore()->release()}...
Q_NODISCARD_CTOR QSemaphoreReleaser(QSemaphore &sem, int n=1) noexcept
Constructor.
void swap(QSemaphoreReleaser &other) noexcept
Exchanges the responsibilities of {*this} and other.
QSemaphore * semaphore() const noexcept
Returns a pointer to the QSemaphore object provided to the constructor, or by the last move assignmen...
bool try_acquire() noexcept
bool try_acquire_for(const std::chrono::duration< Rep, Period > &timeout)
QBasicAtomicInteger< quintptr > u
bool tryAcquire(int n=1)
Tries to acquire n resources guarded by the semaphore and returns true on success.
QBasicAtomicInteger< quint64 > u64
void release(int n=1)
Releases n resources guarded by the semaphore.
bool try_acquire_until(const std::chrono::time_point< Clock, Duration > &tp)
Combined button and popup list for selecting options.
GLbitfield GLuint64 timeout
[4]
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
#define QT_REQUIRE_CONFIG(feature)