diff options
author | Max Kellermann <max@musicpd.org> | 2018-01-29 21:46:07 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-01-29 22:05:58 +0100 |
commit | 3890bc5a96551e52444eb3c97143b6312960f05d (patch) | |
tree | 97590feb6b58ae4c275f0b4882395877af784f22 /src/event/PollGroupWinSelect.cxx | |
parent | 2c65f986d678228b972115781e290fdf5b72fad9 (diff) |
event/Loop: add "noexcept"
Diffstat (limited to 'src/event/PollGroupWinSelect.cxx')
-rw-r--r-- | src/event/PollGroupWinSelect.cxx | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/event/PollGroupWinSelect.cxx b/src/event/PollGroupWinSelect.cxx index 84750c498..39b77ea1f 100644 --- a/src/event/PollGroupWinSelect.cxx +++ b/src/event/PollGroupWinSelect.cxx @@ -26,24 +26,27 @@ constexpr int EVENT_READ = 0; constexpr int EVENT_WRITE = 1; -static inline bool HasEvent(unsigned events, int event_id) +static constexpr +bool HasEvent(unsigned events, int event_id) noexcept { return (events & (1 << event_id)) != 0; } -PollGroupWinSelect::PollGroupWinSelect() { } -PollGroupWinSelect::~PollGroupWinSelect() { } +PollGroupWinSelect::PollGroupWinSelect() noexcept = default; +PollGroupWinSelect::~PollGroupWinSelect() noexcept = default; -bool PollGroupWinSelect::CanModify(PollGroupWinSelect::Item &item, - unsigned events, int event_id) +bool +PollGroupWinSelect::CanModify(PollGroupWinSelect::Item &item, + unsigned events, int event_id) const noexcept { if (item.index[event_id] < 0 && HasEvent(events, event_id)) return !event_set[event_id].IsFull(); return true; } -void PollGroupWinSelect::Modify(PollGroupWinSelect::Item &item, int fd, - unsigned events, int event_id) +void +PollGroupWinSelect::Modify(PollGroupWinSelect::Item &item, int fd, + unsigned events, int event_id) noexcept { int index = item.index[event_id]; auto &set = event_set[event_id]; @@ -60,7 +63,8 @@ void PollGroupWinSelect::Modify(PollGroupWinSelect::Item &item, int fd, } } -bool PollGroupWinSelect::Add(int fd, unsigned events, void *obj) +bool +PollGroupWinSelect::Add(int fd, unsigned events, void *obj) noexcept { assert(items.find(fd) == items.end()); auto &item = items[fd]; @@ -84,7 +88,8 @@ bool PollGroupWinSelect::Add(int fd, unsigned events, void *obj) return true; } -bool PollGroupWinSelect::Modify(int fd, unsigned events, void *obj) +bool +PollGroupWinSelect::Modify(int fd, unsigned events, void *obj) noexcept { auto item_iter = items.find(fd); assert(item_iter != items.end()); @@ -101,7 +106,8 @@ bool PollGroupWinSelect::Modify(int fd, unsigned events, void *obj) return true; } -bool PollGroupWinSelect::Remove(int fd) +bool +PollGroupWinSelect::Remove(int fd) noexcept { auto item_iter = items.find(fd); assert(item_iter != items.end()); @@ -113,7 +119,9 @@ bool PollGroupWinSelect::Remove(int fd) return true; } -void PollGroupWinSelect::ReadEvents(PollResultGeneric &result, int timeout_ms) +void +PollGroupWinSelect::ReadEvents(PollResultGeneric &result, + int timeout_ms) noexcept { bool use_sleep = event_set[EVENT_READ].IsEmpty() && event_set[EVENT_WRITE].IsEmpty(); |