aboutsummaryrefslogtreecommitdiffstats
path: root/fastos
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-02-25 12:26:05 +0000
committerArne Juul <arnej@verizonmedia.com>2021-02-25 12:26:05 +0000
commitd8dfcb14e2c9395b782289ca7c338542adc6f753 (patch)
treed4f86f1431b7e67c669f09390064ddfb8aed0f47 /fastos
parent04ebe23975d172501c2f149927cce2669ebeded8 (diff)
add PTHREAD_STACK_MIN if __pthread_get_minstack is unavailable
Diffstat (limited to 'fastos')
-rw-r--r--fastos/src/vespa/fastos/unix_thread.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/fastos/src/vespa/fastos/unix_thread.cpp b/fastos/src/vespa/fastos/unix_thread.cpp
index 2ba6e306e40..20b3d8e530e 100644
--- a/fastos/src/vespa/fastos/unix_thread.cpp
+++ b/fastos/src/vespa/fastos/unix_thread.cpp
@@ -3,6 +3,7 @@
#include <atomic>
#include <thread>
#include <unistd.h>
+#include <limits.h>
#ifdef __linux__
extern "C" { size_t __pthread_get_minstack(const pthread_attr_t *); }
@@ -67,6 +68,8 @@ bool FastOS_UNIX_Thread::Initialize (int stackSize, int stackGuardSize)
#ifdef __linux__
ssize_t stack_needed_by_system = __pthread_get_minstack(&attr);
adjusted_stack_size += stack_needed_by_system;
+#else
+ adjusted_stack_size += PTHREAD_STACK_MIN;
#endif
pthread_attr_setstacksize(&attr, adjusted_stack_size);