motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit 26e08d57016352c469ae34b3fbd61e7f2a85a76c (tree)
parent ac5ba27c2bd4058dcf0d72fb4b5ad5de443316b4
Author: kprotty <kbutcher6200@gmail.com>
Date:   Mon, 16 Dec 2019 11:51:40 -0600

ResetEvent: use futex on linux when possible

Diffstat:
Mlib/std/reset_event.zig | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/std/reset_event.zig b/lib/std/reset_event.zig @@ -14,10 +14,13 @@ const windows = os.windows; pub const ResetEvent = struct { os_event: OsEvent, - pub const OsEvent = if (builtin.single_threaded) DebugEvent else switch (builtin.os) { - .windows => AtomicEvent, - else => if (builtin.link_libc) PosixEvent else AtomicEvent, - }; + pub const OsEvent = + if (builtin.single_threaded) + DebugEvent + else if (builtin.link_libc and builtin.os != .windows and builtin.os != .linux) + PosixEvent + else + AtomicEvent; pub fn init() ResetEvent { return ResetEvent{ .os_event = OsEvent.init() };