3#include <QtCore/QObject>
18 std::chrono::duration_cast<std::chrono::microseconds>((std::chrono::nanoseconds::max) ());
26 virtual quint64
nowUs()
const = 0;
28 qint64
nowMs()
const {
return static_cast<qint64
>(
nowUs() / 1000); }
38 bool _canSchedule(QObject* context, std::chrono::microseconds delay,
const Callback& callback)
const;
~RuntimeScheduler() override
bool _canSchedule(QObject *context, std::chrono::microseconds delay, const Callback &callback) const
static constexpr auto MAX_DELAY
bool _isCurrentThread() const
virtual quint64 nowUs() const =0
std::function< void()> Callback
virtual TaskId schedule(QObject *context, std::chrono::microseconds delay, Callback callback)=0
static RuntimeScheduler * orDefault(RuntimeScheduler *scheduler, QObject *owner)
scheduler, or a QtRuntimeScheduler owned by owner when it is null.
virtual void cancel(TaskId task)=0
Cancellation from another thread is ignored. All other access and destruction must occur on the owner...