mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Merge pull request #5531 from laytan/thread-stack-size-rlimit
thread: set stack size to rlimit
This commit is contained in:
@@ -81,8 +81,13 @@ _create :: proc(procedure: Thread_Proc, priority: Thread_Priority) -> ^Thread {
|
|||||||
}
|
}
|
||||||
defer posix.pthread_attr_destroy(&attrs)
|
defer posix.pthread_attr_destroy(&attrs)
|
||||||
|
|
||||||
// NOTE(tetra, 2019-11-01): These only fail if their argument is invalid.
|
stacksize: posix.rlimit
|
||||||
|
if res := posix.getrlimit(.STACK, &stacksize); res == .OK && stacksize.rlim_cur > 0 {
|
||||||
|
_ = posix.pthread_attr_setstacksize(&attrs, uint(stacksize.rlim_cur))
|
||||||
|
}
|
||||||
|
|
||||||
res: posix.Errno
|
res: posix.Errno
|
||||||
|
// NOTE(tetra, 2019-11-01): These only fail if their argument is invalid.
|
||||||
res = posix.pthread_attr_setdetachstate(&attrs, .CREATE_JOINABLE)
|
res = posix.pthread_attr_setdetachstate(&attrs, .CREATE_JOINABLE)
|
||||||
assert(res == nil)
|
assert(res == nil)
|
||||||
when ODIN_OS != .Haiku && ODIN_OS != .NetBSD {
|
when ODIN_OS != .Haiku && ODIN_OS != .NetBSD {
|
||||||
|
|||||||
Reference in New Issue
Block a user