[pypy-commit] pypy default: Copy CPython:ecf0ef85c72a: threading fix for OS/X and FreeBSD.

arigo noreply at buildbot.pypy.org
Thu Mar 28 02:33:19 CET 2013


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r62851:e2b3678c1e08
Date: 2013-03-27 23:33 +0100
http://bitbucket.org/pypy/pypy/changeset/e2b3678c1e08/

Log:	Copy CPython:ecf0ef85c72a: threading fix for OS/X and FreeBSD.

diff --git a/rpython/translator/c/src/thread_pthread.c b/rpython/translator/c/src/thread_pthread.c
--- a/rpython/translator/c/src/thread_pthread.c
+++ b/rpython/translator/c/src/thread_pthread.c
@@ -36,6 +36,18 @@
 # ifndef THREAD_STACK_SIZE
 #  define THREAD_STACK_SIZE   0   /* use default stack size */
 # endif
+
+# if (defined(__APPLE__) || defined(__FreeBSD__)) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
+   /* The default stack size for new threads on OSX is small enough that
+    * we'll get hard crashes instead of 'maximum recursion depth exceeded'
+    * exceptions.
+    *
+    * The default stack size below is the minimal stack size where a
+    * simple recursive function doesn't cause a hard crash.
+    */
+#  undef  THREAD_STACK_SIZE
+#  define THREAD_STACK_SIZE       0x400000
+# endif
 /* for safety, ensure a viable minimum stacksize */
 # define THREAD_STACK_MIN    0x8000  /* 32kB */
 #else  /* !_POSIX_THREAD_ATTR_STACKSIZE */


More information about the pypy-commit mailing list