diff options
author | Max Kellermann <max@musicpd.org> | 2017-11-12 17:40:12 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-11-12 17:42:50 +0100 |
commit | c582a9faae16247d4646f5128312dfbda950c376 (patch) | |
tree | d1cc451de3b0e7fbadbcf745d20961002e8c53c6 /src/event | |
parent | cf483107c9fdf67ad29110b8f8c86749ff82442d (diff) |
event/MultiSocketMonitor: add "noexcept"
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/MultiSocketMonitor.cxx | 10 | ||||
-rw-r--r-- | src/event/MultiSocketMonitor.hxx | 36 |
2 files changed, 23 insertions, 23 deletions
diff --git a/src/event/MultiSocketMonitor.cxx b/src/event/MultiSocketMonitor.cxx index 8aac6f740..8dfef02f9 100644 --- a/src/event/MultiSocketMonitor.cxx +++ b/src/event/MultiSocketMonitor.cxx @@ -27,13 +27,13 @@ #include <poll.h> #endif -MultiSocketMonitor::MultiSocketMonitor(EventLoop &_loop) +MultiSocketMonitor::MultiSocketMonitor(EventLoop &_loop) noexcept :IdleMonitor(_loop), timeout_event(_loop, BIND_THIS_METHOD(OnTimeout)) { } void -MultiSocketMonitor::Reset() +MultiSocketMonitor::Reset() noexcept { assert(GetEventLoop().IsInside()); @@ -44,7 +44,7 @@ MultiSocketMonitor::Reset() } void -MultiSocketMonitor::ClearSocketList() +MultiSocketMonitor::ClearSocketList() noexcept { assert(GetEventLoop().IsInside()); @@ -54,7 +54,7 @@ MultiSocketMonitor::ClearSocketList() #ifndef WIN32 void -MultiSocketMonitor::ReplaceSocketList(pollfd *pfds, unsigned n) +MultiSocketMonitor::ReplaceSocketList(pollfd *pfds, unsigned n) noexcept { pollfd *const end = pfds + n; @@ -78,7 +78,7 @@ MultiSocketMonitor::ReplaceSocketList(pollfd *pfds, unsigned n) #endif void -MultiSocketMonitor::Prepare() +MultiSocketMonitor::Prepare() noexcept { const auto timeout = PrepareSockets(); if (timeout >= timeout.zero()) diff --git a/src/event/MultiSocketMonitor.hxx b/src/event/MultiSocketMonitor.hxx index cced28f52..971499d36 100644 --- a/src/event/MultiSocketMonitor.hxx +++ b/src/event/MultiSocketMonitor.hxx @@ -52,30 +52,30 @@ class MultiSocketMonitor : IdleMonitor public: SingleFD(MultiSocketMonitor &_multi, SocketDescriptor _fd, - unsigned events) + unsigned events) noexcept :SocketMonitor(_fd, _multi.GetEventLoop()), multi(_multi), revents(0) { Schedule(events); } - SocketDescriptor GetSocket() const { + SocketDescriptor GetSocket() const noexcept { return SocketMonitor::GetSocket(); } - unsigned GetEvents() const { + unsigned GetEvents() const noexcept { return SocketMonitor::GetScheduledFlags(); } - void SetEvents(unsigned _events) { + void SetEvents(unsigned _events) noexcept { revents &= _events; SocketMonitor::Schedule(_events); } - unsigned GetReturnedEvents() const { + unsigned GetReturnedEvents() const noexcept { return revents; } - void ClearReturnedEvents() { + void ClearReturnedEvents() noexcept { revents = 0; } @@ -113,7 +113,7 @@ public: static constexpr unsigned ERROR = SocketMonitor::ERROR; static constexpr unsigned HANGUP = SocketMonitor::HANGUP; - MultiSocketMonitor(EventLoop &_loop); + MultiSocketMonitor(EventLoop &_loop) noexcept; using IdleMonitor::GetEventLoop; @@ -132,13 +132,13 @@ public: * meantime the #EventLoop thread could invoke those pure * methods. */ - void Reset(); + void Reset() noexcept; /** * Invalidate the socket list. A call to PrepareSockets() is * scheduled which will then update the list. */ - void InvalidateSockets() { + void InvalidateSockets() noexcept { refresh = true; IdleMonitor::Schedule(); } @@ -148,7 +148,7 @@ public: * * May only be called from PrepareSockets(). */ - void AddSocket(SocketDescriptor fd, unsigned events) { + void AddSocket(SocketDescriptor fd, unsigned events) noexcept { fds.emplace_front(*this, fd, events); } @@ -157,7 +157,7 @@ public: * * May only be called from PrepareSockets(). */ - void ClearSocketList(); + void ClearSocketList() noexcept; /** * Update the known sockets by invoking the given function for @@ -168,7 +168,7 @@ public: * May only be called from PrepareSockets(). */ template<typename E> - void UpdateSocketList(E &&e) { + void UpdateSocketList(E &&e) noexcept { for (auto prev = fds.before_begin(), end = fds.end(), i = std::next(prev); i != end; i = std::next(prev)) { @@ -191,7 +191,7 @@ public: * * May only be called from PrepareSockets(). */ - void ReplaceSocketList(pollfd *pfds, unsigned n); + void ReplaceSocketList(pollfd *pfds, unsigned n) noexcept; #endif protected: @@ -202,23 +202,23 @@ protected: * * @return timeout or a negative value for no timeout */ - virtual std::chrono::steady_clock::duration PrepareSockets() = 0; + virtual std::chrono::steady_clock::duration PrepareSockets() noexcept = 0; /** * At least one socket is ready or the timeout has expired. * This method should be used to perform I/O. */ - virtual void DispatchSockets() = 0; + virtual void DispatchSockets() noexcept = 0; private: - void SetReady() { + void SetReady() noexcept { ready = true; IdleMonitor::Schedule(); } - void Prepare(); + void Prepare() noexcept; - void OnTimeout() { + void OnTimeout() noexcept { SetReady(); IdleMonitor::Schedule(); } |