]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/threads.c
some fixes to issues pointed by @tkoeppe
[xonotic/netradiant.git] / tools / quake3 / common / threads.c
index 04946dd2f72edfc87566a954fee655d57becd854..054dc746625ef214d0b73ecc65793160db865cc6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+   Copyright (C) 1999-2007 id Software, Inc. and contributors.
    For a list of contributors, see the accompanying CONTRIBUTORS file.
 
    This file is part of GtkRadiant.
@@ -19,7 +19,8 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef WIN32
+#include "globaldefs.h"
+#if !GDEF_OS_WINDOWS
 // The below define is necessary to use
 // pthreads extensions like pthread_mutexattr_settype
 #define _GNU_SOURCE
@@ -116,7 +117,7 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )(
 
    ===================================================================
  */
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #define USED
 
@@ -424,7 +425,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    =======================================================================
  */
 
-#if defined( __linux__ ) || ( defined( __APPLE__ ) && !MAC_STATIC_HACK )
+#if GDEF_OS_LINUX || ( GDEF_OS_MACOS && !MAC_STATIC_HACK )
 #define USED
 
 #include <unistd.h>
@@ -576,7 +577,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
                for ( i = 0 ; i < numthreads ; i++ )
                {
                        /* Default pthread attributes: joinable & non-realtime scheduling */
-                       if ( pthread_create( &work_threads[i], &attr, (void*)func, (void*)(size_t)i ) != 0 ) {
+                       if ( pthread_create(&work_threads[i], &attr, (void *(*)(void *)) func, (void*)(uintptr_t)i ) != 0 ) {
                                Error( "pthread_create failed" );
                        }
                }
@@ -626,7 +627,6 @@ void ThreadUnlock( void ){
    =============
  */
 void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
-       int i;
        int start, end;
 
        dispatch = 0;