Const-correctness for EpollInstance RAII wrapper

This commit is contained in:
Nav
2022-03-28 20:33:17 +01:00
parent 0b34b6fbab
commit a743381d8c
2 changed files with 4 additions and 2 deletions

View File

@@ -46,7 +46,7 @@ namespace Bloom
} }
} }
std::optional<int> EpollInstance::waitForEvent(std::optional<std::chrono::milliseconds> timeout) { std::optional<int> EpollInstance::waitForEvent(std::optional<std::chrono::milliseconds> timeout) const {
std::array<struct epoll_event, 1> events = {}; std::array<struct epoll_event, 1> events = {};
const auto eventCount = ::epoll_wait( const auto eventCount = ::epoll_wait(

View File

@@ -48,7 +48,9 @@ namespace Bloom
* @return * @return
* The file descriptor of the file for which the event occurred, or std::nullopt if a timeout was reached. * The file descriptor of the file for which the event occurred, or std::nullopt if a timeout was reached.
*/ */
std::optional<int> waitForEvent(std::optional<std::chrono::milliseconds> timeout = std::nullopt); [[nodiscard]] std::optional<int> waitForEvent(
std::optional<std::chrono::milliseconds> timeout = std::nullopt
) const;
/* /*
* EpollInstance objects should not be copied. * EpollInstance objects should not be copied.