system/EPollFD: add "noexcept"

This commit is contained in:
Max Kellermann 2018-01-29 21:48:39 +01:00
parent 7027da3cd3
commit c2f23d92dc
2 changed files with 7 additions and 7 deletions

View File

@ -30,7 +30,7 @@
#define EPOLL_CLOEXEC O_CLOEXEC #define EPOLL_CLOEXEC O_CLOEXEC
static inline int static inline int
epoll_create1(int flags) epoll_create1(int flags) noexcept
{ {
return syscall(__NR_epoll_create1, flags); return syscall(__NR_epoll_create1, flags);
} }

View File

@ -40,7 +40,7 @@ class EPollFD {
public: public:
EPollFD(); EPollFD();
~EPollFD() { ~EPollFD() noexcept {
assert(fd >= 0); assert(fd >= 0);
::close(fd); ::close(fd);
@ -49,15 +49,15 @@ public:
EPollFD(const EPollFD &other) = delete; EPollFD(const EPollFD &other) = delete;
EPollFD &operator=(const EPollFD &other) = delete; EPollFD &operator=(const EPollFD &other) = delete;
int Wait(epoll_event *events, int maxevents, int timeout) { int Wait(epoll_event *events, int maxevents, int timeout) noexcept {
return ::epoll_wait(fd, events, maxevents, timeout); return ::epoll_wait(fd, events, maxevents, timeout);
} }
bool Control(int op, int _fd, epoll_event *event) { bool Control(int op, int _fd, epoll_event *event) noexcept {
return ::epoll_ctl(fd, op, _fd, event) >= 0; return ::epoll_ctl(fd, op, _fd, event) >= 0;
} }
bool Add(int _fd, uint32_t events, void *ptr) { bool Add(int _fd, uint32_t events, void *ptr) noexcept {
epoll_event e; epoll_event e;
e.events = events; e.events = events;
e.data.ptr = ptr; e.data.ptr = ptr;
@ -65,7 +65,7 @@ public:
return Control(EPOLL_CTL_ADD, _fd, &e); return Control(EPOLL_CTL_ADD, _fd, &e);
} }
bool Modify(int _fd, uint32_t events, void *ptr) { bool Modify(int _fd, uint32_t events, void *ptr) noexcept {
epoll_event e; epoll_event e;
e.events = events; e.events = events;
e.data.ptr = ptr; e.data.ptr = ptr;
@ -73,7 +73,7 @@ public:
return Control(EPOLL_CTL_MOD, _fd, &e); return Control(EPOLL_CTL_MOD, _fd, &e);
} }
bool Remove(int _fd) { bool Remove(int _fd) noexcept {
return Control(EPOLL_CTL_DEL, _fd, nullptr); return Control(EPOLL_CTL_DEL, _fd, nullptr);
} }
}; };