authorgravatar for kbutcher6200@gmail.comkprotty <kbutcher6200@gmail.com> 2019-12-16 11:51:40-06:00
committergravatar for kbutcher6200@gmail.comkprotty <kbutcher6200@gmail.com> 2019-12-17 15:38:00-06:00
log26e08d57016352c469ae34b3fbd61e7f2a85a76c
treea4fdd824a59ea8bbc07565ddbe5cfd7708394911
parentac5ba27c2bd4058dcf0d72fb4b5ad5de443316b4

ResetEvent: use futex on linux when possible


1 files changed, 7 insertions(+), 4 deletions(-)

lib/std/reset_event.zig+7-4
...@@ -14,10 +14,13 @@ const windows = os.windows;...@@ -14,10 +14,13 @@ const windows = os.windows;
14pub const ResetEvent = struct {14pub const ResetEvent = struct {
15 os_event: OsEvent,15 os_event: OsEvent,
1616
17 pub const OsEvent = if (builtin.single_threaded) DebugEvent else switch (builtin.os) {17 pub const OsEvent =
18 .windows => AtomicEvent,18 if (builtin.single_threaded)
19 else => if (builtin.link_libc) PosixEvent else AtomicEvent,19 DebugEvent
20 };20 else if (builtin.link_libc and builtin.os != .windows and builtin.os != .linux)
21 PosixEvent
22 else
23 AtomicEvent;
2124
22 pub fn init() ResetEvent {25 pub fn init() ResetEvent {
23 return ResetEvent{ .os_event = OsEvent.init() };26 return ResetEvent{ .os_event = OsEvent.init() };