Skip to content

Commit

Permalink
Catch case where we use the Unix code on a non-Unix system that lacks…
Browse files Browse the repository at this point in the history
… pthreads.

Thanks, Patrice!
  • Loading branch information
icculus committed Feb 4, 2010
1 parent 6d6fec8 commit 5a98fc8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Expand Up @@ -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)
Expand All @@ -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!")
Expand Down
6 changes: 3 additions & 3 deletions src/platform_unix.c
Expand Up @@ -24,7 +24,7 @@
#include <time.h>
#include <errno.h>

#if (!defined PHYSFS_NO_PTHREADS_SUPPORT)
#if (!defined PHYSFS_NO_THREAD_SUPPORT)
#include <pthread.h>
#endif

Expand Down Expand Up @@ -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); }
Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 5a98fc8

Please sign in to comment.