summaryrefslogtreecommitdiff
path: root/src/common/eventfd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/eventfd.cpp')
-rw-r--r--src/common/eventfd.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/eventfd.cpp b/src/common/eventfd.cpp
index 1828b1f..a3dba42 100644
--- a/src/common/eventfd.cpp
+++ b/src/common/eventfd.cpp
@@ -33,6 +33,7 @@ namespace CCHECKER {
EventFD::EventFD(unsigned int initval, int flags)
{
fd = ::eventfd(initval, flags);
+
if (fd == -1) {
throw std::logic_error("EventFd from constructor is failed!!");
}
@@ -48,6 +49,7 @@ EventFD::~EventFD()
void EventFD::send()
{
const std::uint64_t val = 1;
+
if (::write(fd, &val, sizeof(val)) == -1) {
throw std::logic_error("EventFd send to fd is failed!!");
}
@@ -56,6 +58,7 @@ void EventFD::send()
void EventFD::receive()
{
std::uint64_t val;
+
if (::read(fd, &val, sizeof(val)) == -1) {
throw std::logic_error("EventFd read to fd is failed!!");
}