diff options
Diffstat (limited to 'src/rt/sync')
| -rw-r--r-- | src/rt/sync/rust_thread.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rt/sync/rust_thread.cpp b/src/rt/sync/rust_thread.cpp index 70fa08d7f2e..824642fc435 100644 --- a/src/rt/sync/rust_thread.cpp +++ b/src/rt/sync/rust_thread.cpp @@ -10,6 +10,7 @@ #include "rust_thread.h" +#include <limits.h> const size_t default_stack_sz = 1024*1024; @@ -41,6 +42,11 @@ rust_thread::start() { #if defined(__WIN32__) thread = CreateThread(NULL, stack_sz, rust_thread_start, this, 0, NULL); #else + // PTHREAD_STACK_MIN of some system is larger than default size + // so we check stack_sz to prevent assertion failure. + if (stack_sz < PTHREAD_STACK_MIN) { + stack_sz = PTHREAD_STACK_MIN; + } pthread_attr_t attr; CHECKED(pthread_attr_init(&attr)); CHECKED(pthread_attr_setstacksize(&attr, stack_sz)); |
