فهرست منبع

Catch case where we use the Unix code on a non-Unix system that lacks pthreads.

Thanks, Patrice!
(transplanted from 18ae36a7f55bcca606f7d7d5f745f4d9b95e0840)
Ryan C. Gordon 16 سال پیش
والد
کامیت
b45c0ce151
2فایلهای تغییر یافته به همراه4 افزوده شده و 5 حذف شده
  1. 1 2
      CMakeLists.txt
  2. 3 3
      platform/unix.c

+ 1 - 2
CMakeLists.txt

@@ -162,8 +162,6 @@ IF(UNIX)
         CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
         CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
         IF(HAVE_PTHREAD_H)
         IF(HAVE_PTHREAD_H)
             SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
             SET(PHYSFS_HAVE_THREAD_SUPPORT TRUE)
-        ELSE(HAVE_PTHREAD_H)
-            ADD_DEFINITIONS(-DPHYSFS_NO_PTHREADS_SUPPORT=1)
         ENDIF(HAVE_PTHREAD_H)
         ENDIF(HAVE_PTHREAD_H)
     ENDIF(BEOS)
     ENDIF(BEOS)
 ENDIF(UNIX)
 ENDIF(UNIX)
@@ -187,6 +185,7 @@ ENDIF(NOT PHYSFS_HAVE_CDROM_SUPPORT)
 IF(PHYSFS_HAVE_THREAD_SUPPORT)
 IF(PHYSFS_HAVE_THREAD_SUPPORT)
     ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE)
     ADD_DEFINITIONS(-D_REENTRANT -D_THREAD_SAFE)
 ELSE(PHYSFS_HAVE_THREAD_SUPPORT)
 ELSE(PHYSFS_HAVE_THREAD_SUPPORT)
+    ADD_DEFINITIONS(-DPHYSFS_NO_THREAD_SUPPORT=1)
     MESSAGE(WARNING " ***")
     MESSAGE(WARNING " ***")
     MESSAGE(WARNING " *** There is no thread support in this build!")
     MESSAGE(WARNING " *** There is no thread support in this build!")
     MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!")
     MESSAGE(WARNING " *** PhysicsFS will NOT be reentrant!")

+ 3 - 3
platform/unix.c

@@ -25,7 +25,7 @@
 #include <errno.h>
 #include <errno.h>
 #include <sys/mount.h>
 #include <sys/mount.h>
 
 
-#if (!defined PHYSFS_NO_PTHREADS_SUPPORT)
+#if (!defined PHYSFS_NO_THREAD_SUPPORT)
 #include <pthread.h>
 #include <pthread.h>
 #endif
 #endif
 
 
@@ -329,7 +329,7 @@ int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
 } /* __PHYSFS_platformSetDefaultAllocator */
 } /* __PHYSFS_platformSetDefaultAllocator */
 
 
 
 
-#if (defined PHYSFS_NO_PTHREADS_SUPPORT)
+#if (defined PHYSFS_NO_THREAD_SUPPORT)
 
 
 PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); }
 PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); }
 void *__PHYSFS_platformCreateMutex(void) { return((void *) 0x0001); }
 void *__PHYSFS_platformCreateMutex(void) { return((void *) 0x0001); }
@@ -427,7 +427,7 @@ void __PHYSFS_platformReleaseMutex(void *mutex)
     } /* if */
     } /* if */
 } /* __PHYSFS_platformReleaseMutex */
 } /* __PHYSFS_platformReleaseMutex */
 
 
-#endif /* !PHYSFS_NO_PTHREADS_SUPPORT */
+#endif /* !PHYSFS_NO_THREAD_SUPPORT */
 
 
 #endif /* PHYSFS_PLATFORM_UNIX */
 #endif /* PHYSFS_PLATFORM_UNIX */