From 009c95b8ec2f19f6d0db25c9284a7f79a07c387f Mon Sep 17 00:00:00 2001 From: kprotty Date: Fri, 25 Jun 2021 12:43:03 -0500 Subject: [PATCH] std.Thread: more fixes --- lib/std/Thread.zig | 20 ++++++++++---------- lib/std/os/test.zig | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index a956f2d6c9..e7bb645d26 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -397,17 +397,17 @@ const PosixThreadImpl = struct { assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == 0); var handle: c.pthread_t = undefined; - return switch (c.pthread_create( + switch (c.pthread_create( &handle, &attr, Instance.entryFn, @ptrCast(*c_void, args_ptr), )) { - 0 => .{ .handle = handle }, - os.EAGAIN => error.SystemResources, + 0 => return Impl{ .handle = handle }, + os.EAGAIN => return error.SystemResources, os.EPERM => unreachable, os.EINVAL => unreachable, - else => |err| os.unexpectedErrno(err), + else => |err| return os.unexpectedErrno(err), }; } @@ -563,7 +563,7 @@ const LinuxThreadImpl = struct { os.CLONE_PARENT_SETTID | os.CLONE_CHILD_CLEARTID | os.CLONE_DETACHED | os.CLONE_SETTLS; - return switch (linux.getErrno(linux.clone( + switch (linux.getErrno(linux.clone( Instance.entryFn, @ptrToInt(&mapped[stack_offset]), flags, @@ -572,14 +572,14 @@ const LinuxThreadImpl = struct { tls_ptr, &instance.thread.child_tid.value, ))) { - 0 => .{ .thread = &instance.thread }, - os.EAGAIN => error.ThreadQuotaExceeded, + 0 => return Impl{ .thread = &instance.thread }, + os.EAGAIN => return error.ThreadQuotaExceeded, os.EINVAL => unreachable, - os.ENOMEM => error.SystemResources, + os.ENOMEM => return error.SystemResources, os.ENOSPC => unreachable, os.EPERM => unreachable, os.EUSERS => unreachable, - else => |err| os.unexpectedErrno(err), + else => |err| return os.unexpectedErrno(err), }; } @@ -655,7 +655,7 @@ const LinuxThreadImpl = struct { \\ movl $60, %eax \\ syscall ), - .arm, .armeb, .thumb, .thumb_eb => ( + .arm, .armeb, .thumb, .thumbeb => ( \\.syntax unified \\.text \\.global __unmap_and_exit diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 472da73235..750c63d447 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -372,7 +372,7 @@ test "thread local storage" { if (builtin.single_threaded) return error.SkipZigTest; const thread1 = try Thread.spawn(.{}, testTls, .{}); const thread2 = try Thread.spawn(.{}, testTls, .{}); - try testTls({}); + try testTls(); thread1.join(); thread2.join(); }