summaryrefslogtreecommitdiff
path: root/sal/osl/unx/thread.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl/unx/thread.cxx')
-rw-r--r--sal/osl/unx/thread.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index 54e674dd4de5..b122c5f31f3f 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -280,7 +280,7 @@ static oslThread osl_thread_create_Impl (
short nFlags)
{
Thread_Impl* pImpl;
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS)
pthread_attr_t attr;
size_t stacksize;
#endif
@@ -296,14 +296,16 @@ static oslThread osl_thread_create_Impl (
pthread_mutex_lock (&(pImpl->m_Lock));
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS)
if (pthread_attr_init(&attr) != 0)
return nullptr;
#if defined OPENBSD
stacksize = 262144;
-#else
+#elif !ENABLE_RUNTIME_OPTIMIZATIONS
stacksize = 12 * 1024 * 1024; // 8MB is not enough for ASAN on x86-64
+#else
+ stacksize = 1 * 1024 * 1024; // macOS default for non-main threads (512kB) is not enough...
#endif
if (pthread_attr_setstacksize(&attr, stacksize) != 0) {
pthread_attr_destroy(&attr);
@@ -313,7 +315,7 @@ static oslThread osl_thread_create_Impl (
if ((nRet = pthread_create (
&(pImpl->m_hThread),
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS)
&attr,
#else
PTHREAD_ATTR_DEFAULT,
@@ -331,7 +333,7 @@ static oslThread osl_thread_create_Impl (
return nullptr;
}
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && !ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && !ENABLE_RUNTIME_OPTIMIZATIONS)
pthread_attr_destroy(&attr);
#endif