[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 ca8afa7: Require a larger stack size for threads
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] emacs-26 ca8afa7: Require a larger stack size for threads on macOS (bug#30364) |
Date: |
Wed, 28 Feb 2018 19:31:25 -0500 (EST) |
branch: emacs-26
commit ca8afa7672b830d6ed570c21599f3eadb0958d79
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Require a larger stack size for threads on macOS (bug#30364)
* src/systhread.c (sys_thread_create)
[THREADS_ENABLED && HAVE_PTHREAD && DARWIN_OS]:
Require at least 8MB stack size for x64 and 4MB for x86 on macOS.
Do not merge to master.
---
src/systhread.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/systhread.c b/src/systhread.c
index 4ffb7db..c4dcc4e 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -165,6 +165,15 @@ sys_thread_create (sys_thread_t *thread_ptr, const char
*name,
if (pthread_attr_init (&attr))
return 0;
+#ifdef DARWIN_OS
+ /* Avoid crash on macOS with deeply nested GC (Bug#30364). */
+ size_t stack_size;
+ size_t required_stack_size = sizeof (void *) * 1024 * 1024;
+ if (pthread_attr_getstacksize (&attr, &stack_size) == 0
+ && stack_size < required_stack_size)
+ pthread_attr_setstacksize (&attr, required_stack_size);
+#endif
+
if (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED))
{
result = pthread_create (thread_ptr, &attr, func, arg) == 0;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 ca8afa7: Require a larger stack size for threads on macOS (bug#30364),
Paul Eggert <=