aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-05-17 15:13:20 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-05-17 23:50:38 -0700
commit0fafc8cc4409b35649c19af19f7c259ff570c0b5 (patch)
tree1f122e8af15f634b6b392eedb22553db9758eb1a /lib/std/Thread.zig
parentb6798c26efc4689cf35c5f4ac0436b4510a1f813 (diff)
downloadzig-0fafc8cc4409b35649c19af19f7c259ff570c0b5.tar.gz
zig-0fafc8cc4409b35649c19af19f7c259ff570c0b5.zip
std.Thread: insert a missing `@alignCast`
stage1 has a missing compile error for this situation.
Diffstat (limited to 'lib/std/Thread.zig')
-rw-r--r--lib/std/Thread.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index 9e29c82672..06903a9e91 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -893,6 +893,7 @@ const LinuxThreadImpl = struct {
};
fn spawn(config: SpawnConfig, comptime f: anytype, args: anytype) !Impl {
+ const page_size = std.mem.page_size;
const Args = @TypeOf(args);
const Instance = struct {
fn_args: Args,
@@ -915,11 +916,11 @@ const LinuxThreadImpl = struct {
var instance_offset: usize = undefined;
const map_bytes = blk: {
- var bytes: usize = std.mem.page_size;
+ var bytes: usize = page_size;
guard_offset = bytes;
- bytes += std.math.max(std.mem.page_size, config.stack_size);
- bytes = std.mem.alignForward(bytes, std.mem.page_size);
+ bytes += std.math.max(page_size, config.stack_size);
+ bytes = std.mem.alignForward(bytes, page_size);
stack_offset = bytes;
bytes = std.mem.alignForward(bytes, linux.tls.tls_image.alloc_align);
@@ -930,7 +931,7 @@ const LinuxThreadImpl = struct {
instance_offset = bytes;
bytes += @sizeOf(Instance);
- bytes = std.mem.alignForward(bytes, std.mem.page_size);
+ bytes = std.mem.alignForward(bytes, page_size);
break :blk bytes;
};
@@ -954,7 +955,7 @@ const LinuxThreadImpl = struct {
// map everything but the guard page as read/write
os.mprotect(
- mapped[guard_offset..],
+ @alignCast(page_size, mapped[guard_offset..]),
os.PROT.READ | os.PROT.WRITE,
) catch |err| switch (err) {
error.AccessDenied => unreachable,