Set EFD_CLOEXEC

Add missing one.
This commit is contained in:
Hiroki Noda 2017-12-19 13:38:47 +09:00
parent 94028e56dd
commit 214382dcb5

View file

@ -8,6 +8,7 @@ import eventcore.internal.consumablequeue : ConsumableQueue;
version (linux) { version (linux) {
nothrow @nogc extern (C) int eventfd(uint initval, int flags); nothrow @nogc extern (C) int eventfd(uint initval, int flags);
enum EFD_NONBLOCK = 0x800; enum EFD_NONBLOCK = 0x800;
enum EFD_CLOEXEC = 0x80000;
} }
version (Posix) { version (Posix) {
import core.sys.posix.unistd : close, read, write; import core.sys.posix.unistd : close, read, write;
@ -50,7 +51,7 @@ final class PosixEventDriverEvents(Loop : PosixEventLoop, Sockets : EventDriverS
package(eventcore) EventID createInternal(bool is_internal = true) package(eventcore) EventID createInternal(bool is_internal = true)
{ {
version (linux) { version (linux) {
auto eid = eventfd(0, EFD_NONBLOCK); auto eid = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
if (eid == -1) return EventID.invalid; if (eid == -1) return EventID.invalid;
auto id = cast(EventID)eid; auto id = cast(EventID)eid;
m_loop.initFD(id, FDFlags.internal); m_loop.initFD(id, FDFlags.internal);