]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/threads.c
rework GDEF_OS macros
[xonotic/netradiant.git] / tools / quake3 / common / threads.c
index 4cb3e4fee061a7f70e28ca20db843c4eaef32989..5d81cf5eded55ca542f7db18e90a69e1bf8385f7 100644 (file)
 
 #include "globaldefs.h"
 #include <stdint.h>
+
 #if !GDEF_OS_WINDOWS
 // The below define is necessary to use
 // pthreads extensions like pthread_mutexattr_settype
 #define _GNU_SOURCE
-#include <pthread.h>
-#endif
+#endif // !GDEF_OS_WINDOWS
 
 #include "cmdlib.h"
 #include "mathlib.h"
@@ -111,6 +111,8 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )(
 }
 
 
+#if GDEF_OS_WINDOWS
+
 /*
    ===================================================================
 
@@ -118,9 +120,6 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )(
 
    ===================================================================
  */
-#if GDEF_OS_WINDOWS
-
-#define USED
 
 #include <windows.h>
 
@@ -221,7 +220,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
 }
 
 
-#endif
+#elif GDEF_OS_OSF1
 
 /*
    ===================================================================
@@ -231,9 +230,6 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    ===================================================================
  */
 
-#ifdef __osf__
-#define USED
-
 int numthreads = 4;
 
 void ThreadSetDefault( void ){
@@ -242,7 +238,6 @@ void ThreadSetDefault( void ){
        }
 }
 
-
 #include <pthread.h>
 
 pthread_mutex_t *my_mutex;
@@ -328,7 +323,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
 }
 
 
-#endif
+#elif GDEF_OS_IRIX
 
 /*
    ===================================================================
@@ -338,7 +333,6 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    ===================================================================
  */
 
-#ifdef _MIPS_ISA
 #define USED
 
 #include <task.h>
@@ -346,7 +340,6 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
 #include <sys/types.h>
 #include <sys/prctl.h>
 
-
 int numthreads = -1;
 abilock_t lck;
 
@@ -415,8 +408,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
 }
 
 
-#endif
-
+#elif GDEF_OS_LINUX || GDEF_OS_BSD || GDEF_OS_MACOS
 
 /*
    =======================================================================
@@ -426,9 +418,6 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    =======================================================================
  */
 
-#if GDEF_OS_LINUX || GDEF_OS_MACOS
-#define USED
-
 #include <unistd.h>
 
 int numthreads = -1;
@@ -597,9 +586,10 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
                Sys_Printf( " (%i)\n", end - start );
        }
 }
-#endif // ifdef __linux__
 
 
+#else // UNKNOWN OS
+
 /*
    =======================================================================
 
@@ -608,8 +598,6 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    =======================================================================
  */
 
-#ifndef USED
-
 int numthreads = 1;
 
 void ThreadSetDefault( void ){
@@ -643,4 +631,4 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
        }
 }
 
-#endif
+#endif // UNKNOWN OS