diff options
| author | Archbirdplus <archbirdplus@gmail.com> | 2024-10-20 14:55:57 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-02-06 14:23:23 -0800 |
| commit | 439667be0476f5bf60f3efbb82a3c4d5aae96ee4 (patch) | |
| tree | 982fdb5d9260c1c30dee76f89319848e0371b4e2 /lib/std/Thread.zig | |
| parent | b0ed602d5d9358128471588f00a073f2545809fa (diff) | |
| download | zig-439667be0476f5bf60f3efbb82a3c4d5aae96ee4.tar.gz zig-439667be0476f5bf60f3efbb82a3c4d5aae96ee4.zip | |
runtime page size detection
heap.zig: define new default page sizes
heap.zig: add min/max_page_size and their options
lib/std/c: add miscellaneous declarations
heap.zig: add pageSize() and its options
switch to new page sizes, especially in GPA/stdlib
mem.zig: remove page_size
Diffstat (limited to 'lib/std/Thread.zig')
| -rw-r--r-- | lib/std/Thread.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index 4e691de98c..3be80c1641 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -769,7 +769,7 @@ const PosixThreadImpl = struct { // Use the same set of parameters used by the libc-less impl. const stack_size = @max(config.stack_size, 16 * 1024); assert(c.pthread_attr_setstacksize(&attr, stack_size) == .SUCCESS); - assert(c.pthread_attr_setguardsize(&attr, std.mem.page_size) == .SUCCESS); + assert(c.pthread_attr_setguardsize(&attr, std.heap.pageSize()) == .SUCCESS); var handle: c.pthread_t = undefined; switch (c.pthread_create( @@ -1155,7 +1155,7 @@ const LinuxThreadImpl = struct { completion: Completion = Completion.init(.running), child_tid: std.atomic.Value(i32) = std.atomic.Value(i32).init(1), parent_tid: i32 = undefined, - mapped: []align(std.mem.page_size) u8, + mapped: []align(std.heap.min_page_size) u8, /// Calls `munmap(mapped.ptr, mapped.len)` then `exit(1)` without touching the stack (which lives in `mapped.ptr`). /// Ported over from musl libc's pthread detached implementation: @@ -1362,7 +1362,7 @@ const LinuxThreadImpl = struct { }; fn spawn(config: SpawnConfig, comptime f: anytype, args: anytype) !Impl { - const page_size = std.mem.page_size; + const page_size = std.heap.pageSize(); const Args = @TypeOf(args); const Instance = struct { fn_args: Args, |
