From e51048cf0e505fe3e7b508ae7dc4346f1dba2bf8 Mon Sep 17 00:00:00 2001 From: divverent Date: Wed, 6 May 2009 08:04:10 +0000 Subject: [PATCH] set stack size to 8 MB explicitly, should fix light compile crash on OS X git-svn-id: svn://svn.icculus.org/netradiant/trunk@362 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/common/threads.c | 14 ++++++++++++-- tools/quake3/q3map2/main.c | 6 ------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tools/quake3/common/threads.c b/tools/quake3/common/threads.c index ae39832..a486aba 100644 --- a/tools/quake3/common/threads.c +++ b/tools/quake3/common/threads.c @@ -423,7 +423,7 @@ void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) ======================================================================= */ -#if defined(__linux__) || defined(__APPLE__) +#if defined(__linux__) || (defined(__APPLE__) && !MAC_STATIC_HACK) #define USED int numthreads = 4; @@ -525,7 +525,9 @@ RunThreadsOn void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) { pthread_mutexattr_t mattrib; + pthread_attr_t attr; pthread_t work_threads[MAX_THREADS]; + size_t stacksize; int start, end; int i=0, status=0; @@ -536,6 +538,14 @@ void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) dispatch = 0; oldf = -1; workcount = workcnt; + + pthread_attr_init(&attr); + if(pthread_attr_setstacksize(&attr, 8388608) != 0) + { + stacksize = 0; + pthread_attr_getstacksize(&attr, &stacksize); + Sys_Printf("Could not set a per-thread stack size of 8 MB, using only %.2f MB\n", stacksize / 1048576.0); + } if(numthreads == 1) func(0); @@ -555,7 +565,7 @@ void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) for (i=0 ; i 1) - Sys_Printf("MAC_STATIC_HACK does not allow using threads\n"); - numthreads = 1; -#endif - /* init model library */ PicoInit(); PicoSetMallocFunc( safe_malloc ); -- 2.39.2