diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-08-25 00:00:39 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-01 17:54:06 -0700 |
| commit | 7f03cfe161a2f7b5abbd00ab1ea29ddd6190d435 (patch) | |
| tree | 5e3a36e5d74e2d07706b817953e74f13a67c272d /lib/std/Thread | |
| parent | c09ba8796c64a0bd3a39d6545b852c1b2e91f473 (diff) | |
| download | zig-7f03cfe161a2f7b5abbd00ab1ea29ddd6190d435.tar.gz zig-7f03cfe161a2f7b5abbd00ab1ea29ddd6190d435.zip | |
std.os: more reorganization efforts
* std lib tests are passing on x86_64-linux with and without -lc
* stage2 is building from source on x86_64-linux
* down to 38 remaining uses of `usingnamespace`
Diffstat (limited to 'lib/std/Thread')
| -rw-r--r-- | lib/std/Thread/Futex.zig | 6 | ||||
| -rw-r--r-- | lib/std/Thread/ResetEvent.zig | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig index 5a3da5cd94..8411041166 100644 --- a/lib/std/Thread/Futex.zig +++ b/lib/std/Thread/Futex.zig @@ -142,7 +142,7 @@ const LinuxFutex = struct { switch (linux.getErrno(linux.futex_wait( @ptrCast(*const i32, ptr), - linux.FUTEX_PRIVATE_FLAG | linux.FUTEX_WAIT, + linux.FUTEX.PRIVATE_FLAG | linux.FUTEX.WAIT, @bitCast(i32, expect), ts_ptr, ))) { @@ -159,7 +159,7 @@ const LinuxFutex = struct { fn wake(ptr: *const Atomic(u32), num_waiters: u32) void { switch (linux.getErrno(linux.futex_wake( @ptrCast(*const i32, ptr), - linux.FUTEX_PRIVATE_FLAG | linux.FUTEX_WAKE, + linux.FUTEX.PRIVATE_FLAG | linux.FUTEX.WAKE, std.math.cast(i32, num_waiters) catch std.math.maxInt(i32), ))) { .SUCCESS => {}, // successful wake up @@ -352,7 +352,7 @@ const PosixFutex = struct { var ts_ptr: ?*const std.os.timespec = null; if (timeout) |timeout_ns| { ts_ptr = &ts; - std.os.clock_gettime(std.os.CLOCK_REALTIME, &ts) catch unreachable; + std.os.clock_gettime(std.os.CLOCK.REALTIME, &ts) catch unreachable; ts.tv_sec += @intCast(@TypeOf(ts.tv_sec), timeout_ns / std.time.ns_per_s); ts.tv_nsec += @intCast(@TypeOf(ts.tv_nsec), timeout_ns % std.time.ns_per_s); if (ts.tv_nsec >= std.time.ns_per_s) { diff --git a/lib/std/Thread/ResetEvent.zig b/lib/std/Thread/ResetEvent.zig index d9304dd70b..d85cf7f133 100644 --- a/lib/std/Thread/ResetEvent.zig +++ b/lib/std/Thread/ResetEvent.zig @@ -152,7 +152,7 @@ pub const PosixEvent = struct { pub fn timedWait(ev: *PosixEvent, timeout_ns: u64) TimedWaitResult { var ts: os.timespec = undefined; var timeout_abs = timeout_ns; - os.clock_gettime(os.CLOCK_REALTIME, &ts) catch return .timed_out; + os.clock_gettime(os.CLOCK.REALTIME, &ts) catch return .timed_out; timeout_abs += @intCast(u64, ts.tv_sec) * time.ns_per_s; timeout_abs += @intCast(u64, ts.tv_nsec); ts.tv_sec = @intCast(@TypeOf(ts.tv_sec), @divFloor(timeout_abs, time.ns_per_s)); |
