platform/unix.c
changeset 390 6649d6caecf2
parent 381 b65d27fdc8a9
child 392 bcc8e4dca868
--- a/platform/unix.c	Thu Jul 25 16:58:00 2002 +0000
+++ b/platform/unix.c	Thu Jul 25 17:13:03 2002 +0000
@@ -17,7 +17,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <pthread.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <pwd.h>
@@ -28,6 +27,10 @@
 #include <errno.h>
 #include <sys/mount.h>
 
+#if (!defined PHYSFS_NO_PTHREADS_SUPPORT)
+#include <pthread.h>
+#endif
+
 #ifdef PHYSFS_HAVE_SYS_UCRED_H
 #  ifdef PHYSFS_HAVE_MNTENT_H
 #    undef PHYSFS_HAVE_MNTENT_H /* don't do both... */
@@ -256,12 +259,6 @@
 } /* __PHYSFS_platformCalcBaseDir */
 
 
-PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
-{
-    return((PHYSFS_uint64) pthread_self());
-} /* __PHYSFS_platformGetThreadID */
-
-
 /* Much like my college days, try to sleep for 10 milliseconds at a time... */
 void __PHYSFS_platformTimeslice(void)
 {
@@ -283,6 +280,22 @@
 } /* __PHYSFS_platformRealPath */
 
 
+#if (!defined PHYSFS_NO_PTHREADS_SUPPORT)
+
+PHYSFS_uint64 __PHYSFS_platformGetThreadID(void) { return(0x0001); }
+void *__PHYSFS_platformCreateMutex(void) { return((void *) 0x0001); }
+void __PHYSFS_platformDestroyMutex(void *mutex) {}
+int __PHYSFS_platformGrabMutex(void *mutex) { return(1); }
+void __PHYSFS_platformReleaseMutex(void *mutex) {}
+
+#else
+
+PHYSFS_uint64 __PHYSFS_platformGetThreadID(void)
+{
+    return((PHYSFS_uint64) pthread_self());
+} /* __PHYSFS_platformGetThreadID */
+
+
 void *__PHYSFS_platformCreateMutex(void)
 {
     int rc;
@@ -317,6 +330,9 @@
     pthread_mutex_unlock((pthread_mutex_t *) mutex);
 } /* __PHYSFS_platformReleaseMutex */
 
+#endif /* !PHYSFS_NO_PTHREADS_SUPPORT */
+
+
 #endif /* !defined __BEOS__ && !defined WIN32 */
 
 /* end of unix.c ... */