zig
zig copied to clipboard
std.c: adding glibc's pthread_get_minstack useful for thread stack wh…
…en there is thread local storage involved
- Reasoning comes from here.
- Tested with the following `const std = @import("std"); const c = std.c; const os = std.os;
fn task() u8 { return 0; }
pub fn main() !void { var attr: c.pthread_attr_t = undefined; _ = c.pthread_attr_init(&attr); const stack_size = try c.pthread_get_minstack(&attr); std.debug.assert(stack_size >= std.c.PTHREAD_STACK_MIN); const th = try std.Thread.spawn(.{.stack_size = stack_size}, task, .{}); th.join(); _ = c.pthread_attr_destroy(&attr); }`