From 5a98fc83a8a8d545d7d8b52b063c616c51550a3e Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 3 Feb 2010 23:14:11 -0500 Subject: [PATCH] Catch case where we use the Unix code on a non-Unix system that lacks pthreads. Thanks, Patrice! --- CMakeLists.txt | 3 +-- src/platform_unix.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd5e4a56..c124b6e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,8 +191,6 @@ IF(UNIX) CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H) IF(HAVE_PTHREAD_H) SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE) - ELSE(HAVE_PTHREAD_H) - ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1) ENDIF(HAVE_PTHREAD_H) ENDIF(BEOS) ENDIF(UNIX) @@ -216,6 +214,7 @@ ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT) IF(PHYSFS_HAVE_THREAD_SUPPORT) ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE) ELSE(PHYSFS_HAVE_THREAD_SUPPORT) + ADD_DEFINITIONS(-DPHYSFS_NO_THREAD_SUPPORT=1) MESSAGE(WARNING " ***") MESSAGE(WARNING " *** There is no thread support in this build!") MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!") diff --git a/src/platform_unix.c b/src/platform_unix.c index 418968e3..29dda6f5 100644 --- a/src/platform_unix.c +++ b/src/platform_unix.c @@ -24,7 +24,7 @@ #include #include -#if (!defined PHYSFS_NO_PTHREADS_SUPPORT) +#if (!defined PHYSFS_NO_THREAD_SUPPORT) #include #endif @@ -345,7 +345,7 @@ int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a) } /* __PHYSFS_platformSetDefaultAllocator */ -#if (defined PHYSFS_NO_PTHREADS_SUPPORT) +#if (defined PHYSFS_NO_THREAD_SUPPORT) void *__PHYSFS_platformGetThreadID(void) { return ((void *) 0x0001); } void *__PHYSFS_platformCreateMutex(void) { return ((void *) 0x0001); } @@ -429,7 +429,7 @@ void __PHYSFS_platformReleaseMutex(void *mutex) } /* if */ } /* __PHYSFS_platformReleaseMutex */ -#endif /* !PHYSFS_NO_PTHREADS_SUPPORT */ +#endif /* !PHYSFS_NO_THREAD_SUPPORT */ #endif /* PHYSFS_PLATFORM_UNIX */