From: Thomas Debesse Date: Sun, 16 Jun 2019 23:07:57 +0000 (+0200) Subject: h2data: fix build on macos X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c8978f80aa3a7703b9acc45d1c5abb966b11f35a;p=xonotic%2Fnetradiant.git h2data: fix build on macos --- diff --git a/tools/quake2/qdata_heretic2/common/threads.c b/tools/quake2/qdata_heretic2/common/threads.c index 5fe28940..239226b7 100644 --- a/tools/quake2/qdata_heretic2/common/threads.c +++ b/tools/quake2/qdata_heretic2/common/threads.c @@ -86,7 +86,7 @@ void ThreadWorkerFunction( int threadnum ){ if ( work == -1 ) { break; } -//Sys_Printf ("thread %i, work %i\n", threadnum, work); + //Sys_Printf ("thread %i, work %i\n", threadnum, work); workfunction( work ); } } @@ -112,7 +112,8 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )( #include -int numthreads = -1; +// Setting default Threads to 1 +int numthreads = 1; CRITICAL_SECTION crit; static int enter; @@ -227,6 +228,7 @@ void ThreadSetDefault( void ){ } } + #include pthread_mutex_t *my_mutex; @@ -405,7 +407,8 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ ======================================================================= */ -int numthreads = 4; +// Setting default Threads to 1 +int numthreads = 1; void ThreadSetDefault( void ){ if ( numthreads == -1 ) { // not set manually @@ -527,12 +530,9 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){ if ( pthread_mutexattr_init( &mattrib ) != 0 ) { Error( "pthread_mutexattr_init failed" ); } -#if __GLIBC_MINOR__ == 1 - if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_FAST_NP ) != 0 ) -#else - if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_ADAPTIVE_NP ) != 0 ) -#endif - { Error( "pthread_mutexattr_settype failed" ); } + if ( pthread_mutexattr_settype( &mattrib, PTHREAD_MUTEX_ERRORCHECK ) != 0 ) { + Error( "pthread_mutexattr_settype failed" ); + } recursive_mutex_init( mattrib ); for ( i = 0 ; i < numthreads ; i++ ) diff --git a/tools/quake2/qdata_heretic2/images.c b/tools/quake2/qdata_heretic2/images.c index a7138b11..555303bc 100644 --- a/tools/quake2/qdata_heretic2/images.c +++ b/tools/quake2/qdata_heretic2/images.c @@ -25,7 +25,11 @@ #include #endif +#if GDEF_OS_MACOS && !defined( XWINDOWS ) +#include +#else #include +#endif #if 1 extern char *g_outputDir;