aboutsummaryrefslogtreecommitdiff
path: root/lib/std/event
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-11-27 13:38:49 -0500
committerGitHub <noreply@github.com>2019-11-27 13:38:49 -0500
commit83c664eaa080669cff83f7c30046376f3399eafb (patch)
tree06cccc09052be4459e924d04a867ff34a889d87c /lib/std/event
parent63300a21ddf4cfe209a39796c6d7ea7773e14fd6 (diff)
parent4d8a8e65df79ddd5edf52f961552036ccfca6e8e (diff)
downloadzig-83c664eaa080669cff83f7c30046376f3399eafb.tar.gz
zig-83c664eaa080669cff83f7c30046376f3399eafb.zip
Merge pull request #3780 from Vexu/stage2-async-review
Update use of async functions in self hosted compiler
Diffstat (limited to 'lib/std/event')
-rw-r--r--lib/std/event/fs.zig28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/std/event/fs.zig b/lib/std/event/fs.zig
index 0bbc710dfc..346d0f294a 100644
--- a/lib/std/event/fs.zig
+++ b/lib/std/event/fs.zig
@@ -735,24 +735,26 @@ pub fn Watch(comptime V: type) type {
allocator: *Allocator,
const OsData = switch (builtin.os) {
- .macosx, .freebsd, .netbsd, .dragonfly => struct {
- file_table: FileTable,
- table_lock: event.Lock,
-
- const FileTable = std.StringHashMap(*Put);
- const Put = struct {
- putter_frame: @Frame(kqPutEvents),
- cancelled: bool = false,
- value: V,
- };
- },
-
+ // TODO https://github.com/ziglang/zig/issues/3778
+ .macosx, .freebsd, .netbsd, .dragonfly => KqOsData,
.linux => LinuxOsData,
.windows => WindowsOsData,
else => @compileError("Unsupported OS"),
};
+ const KqOsData = struct {
+ file_table: FileTable,
+ table_lock: event.Lock,
+
+ const FileTable = std.StringHashMap(*Put);
+ const Put = struct {
+ putter_frame: @Frame(kqPutEvents),
+ cancelled: bool = false,
+ value: V,
+ };
+ };
+
const WindowsOsData = struct {
table_lock: event.Lock,
dir_table: DirTable,
@@ -1291,7 +1293,7 @@ pub fn Watch(comptime V: type) type {
os.linux.EINVAL => unreachable,
os.linux.EFAULT => unreachable,
os.linux.EAGAIN => {
- global_event_loop.linuxWaitFd(self.os_data.inotify_fd, os.linux.EPOLLET | os.linux.EPOLLIN);
+ global_event_loop.linuxWaitFd(self.os_data.inotify_fd, os.linux.EPOLLET | os.linux.EPOLLIN | os.EPOLLONESHOT);
},
else => unreachable,
}