Commit 6a314466 authored by Max Kellermann's avatar Max Kellermann

event/TimerEvent: add "noexcept"

parent 451fbbce
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
#include "Loop.hxx" #include "Loop.hxx"
void void
TimerEvent::Cancel() TimerEvent::Cancel() noexcept
{ {
if (IsActive()) if (IsActive())
loop.CancelTimer(*this); loop.CancelTimer(*this);
} }
void void
TimerEvent::Schedule(std::chrono::steady_clock::duration d) TimerEvent::Schedule(std::chrono::steady_clock::duration d) noexcept
{ {
Cancel(); Cancel();
......
...@@ -55,27 +55,27 @@ class TimerEvent final { ...@@ -55,27 +55,27 @@ class TimerEvent final {
std::chrono::steady_clock::time_point due; std::chrono::steady_clock::time_point due;
public: public:
TimerEvent(EventLoop &_loop, Callback _callback) TimerEvent(EventLoop &_loop, Callback _callback) noexcept
:loop(_loop), callback(_callback) { :loop(_loop), callback(_callback) {
} }
~TimerEvent() { ~TimerEvent() noexcept {
Cancel(); Cancel();
} }
EventLoop &GetEventLoop() { EventLoop &GetEventLoop() noexcept {
return loop; return loop;
} }
bool IsActive() const { bool IsActive() const noexcept {
return timer_set_hook.is_linked(); return timer_set_hook.is_linked();
} }
void Schedule(std::chrono::steady_clock::duration d); void Schedule(std::chrono::steady_clock::duration d) noexcept;
void Cancel(); void Cancel() noexcept;
private: private:
void Run() { void Run() noexcept {
callback(); callback();
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment