Abstract out usleep() call.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 18 May 2013 20:07:49 -0400
changeset 56 ae6187c48b12
parent 55 8174c4ef22dc
child 57 7b46b27f8aa7
Abstract out usleep() call.
theoraplay.c
--- a/theoraplay.c	Tue Apr 23 10:03:00 2013 -0400
+++ b/theoraplay.c	Sat May 18 20:07:49 2013 -0400
@@ -19,8 +19,11 @@
 #include <windows.h>
 #define THEORAPLAY_THREAD_T    HANDLE
 #define THEORAPLAY_MUTEX_T     HANDLE
+#define sleepms(x) Sleep(x)
 #else
 #include <pthread.h>
+#include <unistd.h>
+#define sleepms(x) usleep((x) * 1000)
 #define THEORAPLAY_THREAD_T    pthread_t
 #define THEORAPLAY_MUTEX_T     pthread_mutex_t
 #endif
@@ -530,7 +533,7 @@
                 go_on = !ctx->halt && (ctx->videocount >= ctx->maxframes);
                 Mutex_Unlock(ctx->lock);
                 if (go_on)
-                    usleep(10000);
+                    sleepms(10);
             } // while
             //printf("Awake!\n");
         } // if