aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVincent Rischmann <vincent@rischmann.fr>2021-04-26 18:03:32 +0200
committerGitHub <noreply@github.com>2021-04-26 18:03:32 +0200
commit77cb45f59f7b37c316af1762298d6032e2b130b5 (patch)
treead6bc515f8249b63f96de3fe57e1bf79000a3e3f /lib
parentbf67a3fdc9efea7126058b21e687c24868bc1268 (diff)
downloadzig-77cb45f59f7b37c316af1762298d6032e2b130b5.tar.gz
zig-77cb45f59f7b37c316af1762298d6032e2b130b5.zip
thread: simplify and remove useless return in spawn (#8621)
Diffstat (limited to 'lib')
-rw-r--r--lib/std/Thread.zig12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index 01405b104f..92221e8786 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -360,15 +360,13 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF
MainFuncs.posixThreadMain,
thread_obj.data.memory.ptr,
);
- switch (err) {
- 0 => return thread_obj,
- os.EAGAIN => return error.SystemResources,
+ return switch (err) {
+ 0 => thread_obj,
+ os.EAGAIN => error.SystemResources,
os.EPERM => unreachable,
os.EINVAL => unreachable,
- else => return os.unexpectedErrno(err),
- }
-
- return thread_obj;
+ else => os.unexpectedErrno(err),
+ };
}
var guard_end_offset: usize = undefined;