From ea1de499b3ccb4b3999633f021ff67038624bcbb Mon Sep 17 00:00:00 2001 From: Leon Marz Date: Sat, 18 Nov 2023 14:37:25 +0100 Subject: [PATCH] Fix: Increase thread stack size for musl libc Manually set the stack size to 2mb, same as with Apple Co-authored-by: Damian Kurek Pull Request: https://projects.blender.org/blender/blender/pulls/115094 --- intern/cycles/util/thread.cpp | 6 +++--- intern/cycles/util/thread.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/intern/cycles/util/thread.cpp b/intern/cycles/util/thread.cpp index c361beedf4c..c908d547a35 100644 --- a/intern/cycles/util/thread.cpp +++ b/intern/cycles/util/thread.cpp @@ -13,8 +13,8 @@ CCL_NAMESPACE_BEGIN thread::thread(function run_cb) : run_cb_(run_cb), joined_(false) { -#ifdef __APPLE__ - /* Set the stack size to 2MB to match Linux. The default 512KB on macOS is +#if defined(__APPLE__) || defined(__linux__) && !defined(__GLIBC__) + /* Set the stack size to 2MB to match glibc. The default 512KB on macOS is * too small for Embree, and consistent stack size also makes things more * predictable in general. */ pthread_attr_t attribute; @@ -43,7 +43,7 @@ void *thread::run(void *arg) bool thread::join() { joined_ = true; -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__linux__) && !defined(__GLIBC__) return pthread_join(pthread_id, NULL) == 0; #else try { diff --git a/intern/cycles/util/thread.h b/intern/cycles/util/thread.h index 35ee0134b2c..1a32a13610a 100644 --- a/intern/cycles/util/thread.h +++ b/intern/cycles/util/thread.h @@ -43,7 +43,7 @@ class thread { protected: function run_cb_; -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__linux__) && !defined(__GLIBC__) pthread_t pthread_id; #else std::thread std_thread;