authorgravatar for kbutcher6200@gmail.comkprotty <kbutcher6200@gmail.com> 2021-06-25 12:43:03-05:00
committergravatar for kbutcher6200@gmail.comkprotty <kbutcher6200@gmail.com> 2021-06-30 21:49:00-05:00
log009c95b8ec2f19f6d0db25c9284a7f79a07c387f
tree6f696a861dbeb8d64a4269adbe85616ee3152bcd
parent5f4a40e6aa7709fe708f9b20b32f63a50cc64736

std.Thread: more fixes


2 files changed, 11 insertions(+), 11 deletions(-)

lib/std/Thread.zig+10-10
...@@ -397,17 +397,17 @@ const PosixThreadImpl = struct {...@@ -397,17 +397,17 @@ const PosixThreadImpl = struct {
397 assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == 0);397 assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == 0);
398398
399 var handle: c.pthread_t = undefined;399 var handle: c.pthread_t = undefined;
400 return switch (c.pthread_create(400 switch (c.pthread_create(
401 &handle,401 &handle,
402 &attr,402 &attr,
403 Instance.entryFn,403 Instance.entryFn,
404 @ptrCast(*c_void, args_ptr),404 @ptrCast(*c_void, args_ptr),
405 )) {405 )) {
406 0 => .{ .handle = handle },406 0 => return Impl{ .handle = handle },
407 os.EAGAIN => error.SystemResources,407 os.EAGAIN => return error.SystemResources,
408 os.EPERM => unreachable,408 os.EPERM => unreachable,
409 os.EINVAL => unreachable,409 os.EINVAL => unreachable,
410 else => |err| os.unexpectedErrno(err),410 else => |err| return os.unexpectedErrno(err),
411 };411 };
412 }412 }
413413
...@@ -563,7 +563,7 @@ const LinuxThreadImpl = struct {...@@ -563,7 +563,7 @@ const LinuxThreadImpl = struct {
563 os.CLONE_PARENT_SETTID | os.CLONE_CHILD_CLEARTID |563 os.CLONE_PARENT_SETTID | os.CLONE_CHILD_CLEARTID |
564 os.CLONE_DETACHED | os.CLONE_SETTLS;564 os.CLONE_DETACHED | os.CLONE_SETTLS;
565565
566 return switch (linux.getErrno(linux.clone(566 switch (linux.getErrno(linux.clone(
567 Instance.entryFn,567 Instance.entryFn,
568 @ptrToInt(&mapped[stack_offset]),568 @ptrToInt(&mapped[stack_offset]),
569 flags,569 flags,
...@@ -572,14 +572,14 @@ const LinuxThreadImpl = struct {...@@ -572,14 +572,14 @@ const LinuxThreadImpl = struct {
572 tls_ptr,572 tls_ptr,
573 &instance.thread.child_tid.value,573 &instance.thread.child_tid.value,
574 ))) {574 ))) {
575 0 => .{ .thread = &instance.thread },575 0 => return Impl{ .thread = &instance.thread },
576 os.EAGAIN => error.ThreadQuotaExceeded,576 os.EAGAIN => return error.ThreadQuotaExceeded,
577 os.EINVAL => unreachable,577 os.EINVAL => unreachable,
578 os.ENOMEM => error.SystemResources,578 os.ENOMEM => return error.SystemResources,
579 os.ENOSPC => unreachable,579 os.ENOSPC => unreachable,
580 os.EPERM => unreachable,580 os.EPERM => unreachable,
581 os.EUSERS => unreachable,581 os.EUSERS => unreachable,
582 else => |err| os.unexpectedErrno(err),582 else => |err| return os.unexpectedErrno(err),
583 };583 };
584 }584 }
585585
...@@ -655,7 +655,7 @@ const LinuxThreadImpl = struct {...@@ -655,7 +655,7 @@ const LinuxThreadImpl = struct {
655 \\ movl $60, %eax655 \\ movl $60, %eax
656 \\ syscall656 \\ syscall
657 ),657 ),
658 .arm, .armeb, .thumb, .thumb_eb => (658 .arm, .armeb, .thumb, .thumbeb => (
659 \\.syntax unified659 \\.syntax unified
660 \\.text660 \\.text
661 \\.global __unmap_and_exit661 \\.global __unmap_and_exit
lib/std/os/test.zig+1-1
...@@ -372,7 +372,7 @@ test "thread local storage" {...@@ -372,7 +372,7 @@ test "thread local storage" {
372 if (builtin.single_threaded) return error.SkipZigTest;372 if (builtin.single_threaded) return error.SkipZigTest;
373 const thread1 = try Thread.spawn(.{}, testTls, .{});373 const thread1 = try Thread.spawn(.{}, testTls, .{});
374 const thread2 = try Thread.spawn(.{}, testTls, .{});374 const thread2 = try Thread.spawn(.{}, testTls, .{});
375 try testTls({});375 try testTls();
376 thread1.join();376 thread1.join();
377 thread2.join();377 thread2.join();
378}378}