aboutsummaryrefslogtreecommitdiff
path: root/lib/std/event/loop.zig
diff options
context:
space:
mode:
authorTse <1@tse.gratis>2019-10-23 01:06:35 +0300
committerAndrew Kelley <andrew@ziglang.org>2019-10-30 21:21:58 -0400
commit33cc2044811e41a74e3112fc0abcc5dc6fd34836 (patch)
tree380b8a0e296e32fae4415035338ec268c1a1beaf /lib/std/event/loop.zig
parent7c7350345147c61e3e0873c3c4f233e351a3910a (diff)
downloadzig-33cc2044811e41a74e3112fc0abcc5dc6fd34836.tar.gz
zig-33cc2044811e41a74e3112fc0abcc5dc6fd34836.zip
DragonFlyBSD support
Diffstat (limited to 'lib/std/event/loop.zig')
-rw-r--r--lib/std/event/loop.zig21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/std/event/loop.zig b/lib/std/event/loop.zig
index d0d36abc0c..22013edba6 100644
--- a/lib/std/event/loop.zig
+++ b/lib/std/event/loop.zig
@@ -51,7 +51,7 @@ pub const Loop = struct {
};
pub const EventFd = switch (builtin.os) {
- .macosx, .freebsd, .netbsd => KEventFd,
+ .macosx, .freebsd, .netbsd, .dragonfly => KEventFd,
.linux => struct {
base: ResumeNode,
epoll_op: u32,
@@ -70,7 +70,7 @@ pub const Loop = struct {
};
pub const Basic = switch (builtin.os) {
- .macosx, .freebsd, .netbsd => KEventBasic,
+ .macosx, .freebsd, .netbsd, .dragonfly => KEventBasic,
.linux => struct {
base: ResumeNode,
},
@@ -244,7 +244,7 @@ pub const Loop = struct {
self.extra_threads[extra_thread_index] = try Thread.spawn(self, workerRun);
}
},
- .macosx, .freebsd, .netbsd => {
+ .macosx, .freebsd, .netbsd, .dragonfly => {
self.os_data.kqfd = try os.kqueue();
errdefer os.close(self.os_data.kqfd);
@@ -409,7 +409,7 @@ pub const Loop = struct {
os.close(self.os_data.epollfd);
self.allocator.free(self.eventfd_resume_nodes);
},
- .macosx, .freebsd, .netbsd => {
+ .macosx, .freebsd, .netbsd, .dragonfly => {
os.close(self.os_data.kqfd);
os.close(self.os_data.fs_kqfd);
},
@@ -523,7 +523,7 @@ pub const Loop = struct {
const eventfd_node = &resume_stack_node.data;
eventfd_node.base.handle = next_tick_node.data;
switch (builtin.os) {
- .macosx, .freebsd, .netbsd => {
+ .macosx, .freebsd, .netbsd, .dragonfly => {
const kevent_array = (*const [1]os.Kevent)(&eventfd_node.kevent);
const empty_kevs = ([*]os.Kevent)(undefined)[0..0];
_ = os.kevent(self.os_data.kqfd, kevent_array, empty_kevs, null) catch {
@@ -587,6 +587,7 @@ pub const Loop = struct {
.macosx,
.freebsd,
.netbsd,
+ .dragonfly,
=> self.os_data.fs_thread.wait(),
else => {},
}
@@ -644,7 +645,7 @@ pub const Loop = struct {
os.write(self.os_data.final_eventfd, wakeup_bytes) catch unreachable;
return;
},
- .macosx, .freebsd, .netbsd => {
+ .macosx, .freebsd, .netbsd, .dragonfly => {
self.posixFsRequest(&self.os_data.fs_end_request);
const final_kevent = (*const [1]os.Kevent)(&self.os_data.final_kevent);
const empty_kevs = ([*]os.Kevent)(undefined)[0..0];
@@ -702,7 +703,7 @@ pub const Loop = struct {
}
}
},
- .macosx, .freebsd, .netbsd => {
+ .macosx, .freebsd, .netbsd, .dragonfly => {
var eventlist: [1]os.Kevent = undefined;
const empty_kevs = ([*]os.Kevent)(undefined)[0..0];
const count = os.kevent(self.os_data.kqfd, empty_kevs, eventlist[0..], null) catch unreachable;
@@ -765,7 +766,7 @@ pub const Loop = struct {
self.beginOneEvent(); // finished in posixFsRun after processing the msg
self.os_data.fs_queue.put(request_node);
switch (builtin.os) {
- .macosx, .freebsd, .netbsd => {
+ .macosx, .freebsd, .netbsd, .dragonfly => {
const fs_kevs = (*const [1]os.Kevent)(&self.os_data.fs_kevent_wake);
const empty_kevs = ([*]os.Kevent)(undefined)[0..0];
_ = os.kevent(self.os_data.fs_kqfd, fs_kevs, empty_kevs, null) catch unreachable;
@@ -838,7 +839,7 @@ pub const Loop = struct {
else => unreachable,
}
},
- .macosx, .freebsd, .netbsd => {
+ .macosx, .freebsd, .netbsd, .dragonfly => {
const fs_kevs = (*const [1]os.Kevent)(&self.os_data.fs_kevent_wait);
var out_kevs: [1]os.Kevent = undefined;
_ = os.kevent(self.os_data.fs_kqfd, fs_kevs, out_kevs[0..], null) catch unreachable;
@@ -850,7 +851,7 @@ pub const Loop = struct {
const OsData = switch (builtin.os) {
.linux => LinuxOsData,
- .macosx, .freebsd, .netbsd => KEventData,
+ .macosx, .freebsd, .netbsd, .dragonfly => KEventData,
.windows => struct {
io_port: windows.HANDLE,
extra_thread_count: usize,