summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <0x7fffff@guattari.ru>2022-08-18 19:11:18 +0400
committerMitya Selivanov <0x7fffff@guattari.ru>2022-08-18 19:11:18 +0400
commita06f6ec396abe23cdccf5ed96ebdf2897c4ee3e3 (patch)
treefb2122116ad04aeaeae4302c717d27f552da83aa
parent25fe38c33eebfc5ecf1b4ed8be6bfd74ee0736cf (diff)
downloadkit-a06f6ec396abe23cdccf5ed96ebdf2897c4ee3e3.zip
test
-rw-r--r--source/kit/threads.posix.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/source/kit/threads.posix.c b/source/kit/threads.posix.c
index c42c67e..2dea666 100644
--- a/source/kit/threads.posix.c
+++ b/source/kit/threads.posix.c
@@ -244,10 +244,9 @@ int thrd_create_with_stack(thrd_t *thr, thrd_start_t func, void *arg,
if (require_stack_size > 0) {
ptrdiff_t const page_size = (ptrdiff_t) sysconf(_SC_PAGESIZE);
ptrdiff_t const delta = require_stack_size % page_size;
- ptrdiff_t const stack_size = delta == 0
- ? require_stack_size
- : require_stack_size +
- require_stack_size - delta;
+ ptrdiff_t const stack_size = delta == 0 ? require_stack_size
+ : require_stack_size +
+ page_size - delta;
if (pthread_attr_init(&attr) != 0)
return thrd_nomem;
if (pthread_attr_setstacksize(&attr, (size_t) stack_size) != 0) {