Support compiling without pthreads
[pcsx_rearmed.git] / libpcsxcore / cdriso.c
index 8367750..232a979 100644 (file)
 #include <process.h>
 #include <windows.h>
 #define strcasecmp _stricmp
-#else
+#elif HAVE_PTHREAD
 #include <pthread.h>
 #include <sys/time.h>
 #include <unistd.h>
 #endif
 
-#ifndef _WIN32
 // to enable the USE_READ_THREAD code, fix:
 // - https://github.com/notaz/pcsx_rearmed/issues/257
 // - ISOgetBufferSub to not race with async code
-//#define USE_READ_THREAD
-#endif
+#define USE_READ_THREAD 0 //HAVE_PTHREAD
 
 #ifdef USE_LIBRETRO_VFS
 #include <streams/file_stream_transforms.h>
@@ -1079,7 +1077,7 @@ static int opensbifile(const char *isoname) {
        return LoadSBI(sbiname, s);
 }
 
-#ifndef USE_READ_THREAD
+#if !USE_READ_THREAD
 static void readThreadStop() {}
 static void readThreadStart() {}
 #else
@@ -1497,7 +1495,7 @@ static int cdread_2048(FILE *f, unsigned int base, void *dest, int sector)
        return 12*2 + ret;
 }
 
-#ifdef USE_READ_THREAD
+#if USE_READ_THREAD
 
 static int cdread_async(FILE *f, unsigned int base, void *dest, int sector) {
   boolean found = FALSE;
@@ -1555,7 +1553,7 @@ static unsigned char * CALLBACK ISOgetBuffer_chd(void) {
 }
 #endif
 
-#ifdef USE_READ_THREAD
+#if USE_READ_THREAD
 static unsigned char * CALLBACK ISOgetBuffer_async(void) {
   unsigned char *buffer;
   pthread_mutex_lock(&sectorbuffer_lock);
@@ -1563,7 +1561,6 @@ static unsigned char * CALLBACK ISOgetBuffer_async(void) {
   pthread_mutex_unlock(&sectorbuffer_lock);
   return buffer + 12;
 }
-
 #endif
 
 static unsigned char * CALLBACK ISOgetBuffer(void) {