X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fcommon%2Fthreads.c;h=7f404a4f03da537b6b90f33c09647ca65139f2a3;hb=d5a9782200fa1447fc8de8705a2183ecd14db2b0;hp=ed218d6ee960d8992cf41f736fed3537f7cc4080;hpb=0d2933a8b4d0cb87cb8ccc26d5ee979ce9a9703b;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/common/threads.c b/tools/quake3/common/threads.c index ed218d6e..7f404a4f 100644 --- a/tools/quake3/common/threads.c +++ b/tools/quake3/common/threads.c @@ -60,12 +60,17 @@ int GetThreadWork (void) } f = 40*dispatch / workcount; - if (f != oldf) + if(f < oldf) { + Sys_Printf("warning: progress went backwards (should never happen)\n"); oldf = f; + } + while(f > oldf) + { + ++oldf; if (pacifier) { - if(f % 4 == 0) + if(oldf % 4 == 0) Sys_Printf("%i", f / 4); else Sys_Printf ("."); @@ -418,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; @@ -520,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; @@ -531,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); @@ -550,7 +565,7 @@ void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) for (i=0 ; i