io/FileDescriptor: fold CreateEventFD() into the EventFD constructor
This commit is contained in:
parent
598894211f
commit
b5fbfe9aa6
|
@ -238,13 +238,6 @@ FileDescriptor::CheckDuplicate(FileDescriptor new_fd) const noexcept
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
|
||||||
bool
|
|
||||||
FileDescriptor::CreateEventFD(unsigned initval) noexcept
|
|
||||||
{
|
|
||||||
fd = ::eventfd(initval, EFD_NONBLOCK|EFD_CLOEXEC);
|
|
||||||
return fd >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept
|
FileDescriptor::CreateSignalFD(const sigset_t *mask) noexcept
|
||||||
{
|
{
|
||||||
|
|
|
@ -181,7 +181,6 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
bool CreateEventFD(unsigned initval=0) noexcept;
|
|
||||||
bool CreateSignalFD(const sigset_t *mask) noexcept;
|
bool CreateSignalFD(const sigset_t *mask) noexcept;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
|
|
||||||
EventFD::EventFD()
|
EventFD::EventFD()
|
||||||
|
:fd(::eventfd(0, EFD_NONBLOCK|EFD_CLOEXEC))
|
||||||
{
|
{
|
||||||
if (!fd.CreateEventFD(0))
|
if (!fd.IsDefined())
|
||||||
throw MakeErrno("eventfd() failed");
|
throw MakeErrno("eventfd() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue