aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/systhread.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/systhread.c b/src/systhread.c
index 4ffb7db143a..c4dcc4e9069 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -165,6 +165,15 @@ sys_thread_create (sys_thread_t *thread_ptr, const char *name,
165 if (pthread_attr_init (&attr)) 165 if (pthread_attr_init (&attr))
166 return 0; 166 return 0;
167 167
168#ifdef DARWIN_OS
169 /* Avoid crash on macOS with deeply nested GC (Bug#30364). */
170 size_t stack_size;
171 size_t required_stack_size = sizeof (void *) * 1024 * 1024;
172 if (pthread_attr_getstacksize (&attr, &stack_size) == 0
173 && stack_size < required_stack_size)
174 pthread_attr_setstacksize (&attr, required_stack_size);
175#endif
176
168 if (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED)) 177 if (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED))
169 { 178 {
170 result = pthread_create (thread_ptr, &attr, func, arg) == 0; 179 result = pthread_create (thread_ptr, &attr, func, arg) == 0;