29 #ifndef Pt_System_Timer_h
30 #define Pt_System_Timer_h
32 #include <Pt/System/Api.h>
33 #include <Pt/Signal.h>
34 #include <Pt/Timespan.h>
37 #if __cplusplus >= 202002L
38 #include <Pt/Coroutine.h>
166 {
return _finished; }
168 #if __cplusplus >= 202002L
181 AsyncWait waitAsync(std::size_t ms);
187 std::size_t _interval;
193 #if __cplusplus >= 202002L
203 class PT_SYSTEM_API AsyncWait :
public Pt::BasicAwaiter<void>
212 AsyncWait(Timer& timer, std::size_t ms);
215 void onBegin()
override;
217 void onCancel()
override;
219 void onReady()
override;
225 #endif // __cplusplus >= 202002L
231 #endif // Pt_System_Timer_h
Core module.
Definition: Allocator.h:33
Signal & timeout()
Notifies about interval timeouts.
Definition: Timer.h:161
void start(const Pt::Timespan &interval)
Starts the timer.
Notifies clients in constant intervals.
Definition: Timer.h:79
Multicast Signal to call multiple slots.
Definition: Signal.h:190
std::size_t interval() const
Returns the current timer interval in milliseconds.
void setActive(EventLoop &loop)
Sets the used event loop.
void stop()
Stops the timer.
void detach()
Detach from used event loop.
Connection Management for Signal and Slot Objects.
Definition: Connectable.h:50
bool isStarted() const
Returs true if timer was started.
Represents time spans in microsecond resolution.
Definition: Timespan.h:63
Thread-safe event loop supporting I/O multiplexing and Timers.
Definition: EventLoop.h:83
EventLoop * loop()
Returns the used event loop.
Definition: Timer.h:101
Timer()
Default constructor.
void start(std::size_t interval)
Starts the timer.