mirror of
https://github.com/ziglang/zig.git
synced 2026-01-09 08:55:36 +00:00
std: Fix parameters for pthread_attr_setstack
The guard page size shouldn't be taken into account, pthread is only interested in the usable area.
This commit is contained in:
parent
09a5f172f8
commit
b21d3535a5
@ -375,7 +375,12 @@ pub const Thread = struct {
|
||||
if (c.pthread_attr_init(&attr) != 0) return error.SystemResources;
|
||||
defer assert(c.pthread_attr_destroy(&attr) == 0);
|
||||
|
||||
assert(c.pthread_attr_setstack(&attr, mmap_slice.ptr, stack_end_offset) == 0);
|
||||
// Tell pthread where the effective stack start is and its size
|
||||
assert(c.pthread_attr_setstack(
|
||||
&attr,
|
||||
mmap_slice.ptr + guard_end_offset,
|
||||
stack_end_offset - guard_end_offset,
|
||||
) == 0);
|
||||
|
||||
const err = c.pthread_create(&thread_ptr.data.handle, &attr, MainFuncs.posixThreadMain, @intToPtr(*c_void, arg));
|
||||
switch (err) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user