diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-04-26 10:44:40 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-04-26 10:44:40 -0700 |
| commit | ddf9ff79bd2eccadafcdf12b191c62c66b247b64 (patch) | |
| tree | b1f5f2d6be676d0435024d464b3af7facdd617c3 /lib/std/Thread.zig | |
| parent | 77cb45f59f7b37c316af1762298d6032e2b130b5 (diff) | |
| download | zig-ddf9ff79bd2eccadafcdf12b191c62c66b247b64.tar.gz zig-ddf9ff79bd2eccadafcdf12b191c62c66b247b64.zip | |
Revert "thread: simplify and remove useless return in spawn (#8621)"
This reverts commit 77cb45f59f7b37c316af1762298d6032e2b130b5.
Zig's error return traces will point to the return token if they
happen to occur, so having multiple return statements makes those
stack traces really helpful. This destroys debuggability.
Diffstat (limited to 'lib/std/Thread.zig')
| -rw-r--r-- | lib/std/Thread.zig | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index 92221e8786..01405b104f 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -360,13 +360,15 @@ pub fn spawn(comptime startFn: anytype, context: SpawnContextType(@TypeOf(startF MainFuncs.posixThreadMain, thread_obj.data.memory.ptr, ); - return switch (err) { - 0 => thread_obj, - os.EAGAIN => error.SystemResources, + switch (err) { + 0 => return thread_obj, + os.EAGAIN => return error.SystemResources, os.EPERM => unreachable, os.EINVAL => unreachable, - else => os.unexpectedErrno(err), - }; + else => return os.unexpectedErrno(err), + } + + return thread_obj; } var guard_end_offset: usize = undefined; |
