Merge pull request #45 from kubo39/efd-cloexec

Set EFD_CLOEXEC
This commit is contained in:
Sönke Ludwig 2017-12-19 10:45:11 +01:00 committed by GitHub
commit 324338205b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,7 @@ import eventcore.internal.consumablequeue : ConsumableQueue;
version (linux) {
nothrow @nogc extern (C) int eventfd(uint initval, int flags);
enum EFD_NONBLOCK = 0x800;
enum EFD_CLOEXEC = 0x80000;
}
version (Posix) {
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)
{
version (linux) {
auto eid = eventfd(0, EFD_NONBLOCK);
auto eid = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
if (eid == -1) return EventID.invalid;
auto id = cast(EventID)eid;
m_loop.initFD(id, FDFlags.internal);