aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/systhread.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/systhread.c b/src/systhread.c
index 3f162a2bcbf..e972ed398ac 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -177,6 +177,13 @@ sys_thread_create (sys_thread_t *thread_ptr, const char *name,
177 if (pthread_attr_init (&attr)) 177 if (pthread_attr_init (&attr))
178 return 0; 178 return 0;
179 179
180 /* Avoid crash on macOS with deeply nested GC (Bug#30364). */
181 size_t stack_size;
182 size_t required_stack_size = sizeof (void *) * 1024 * 1024;
183 if (pthread_attr_getstacksize (&attr, &stack_size) == 0
184 && stack_size < required_stack_size)
185 pthread_attr_setstacksize (&attr, required_stack_size);
186
180 if (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED)) 187 if (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED))
181 { 188 {
182 result = pthread_create (thread_ptr, &attr, func, arg) == 0; 189 result = pthread_create (thread_ptr, &attr, func, arg) == 0;