Skip to content

Commit

Permalink
Abstract out usleep() call.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 19, 2013
1 parent 70889fb commit b79ceb2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion theoraplay.c
Expand Up @@ -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
Expand Down Expand Up @@ -530,7 +533,7 @@ static void WorkerThread(TheoraDecoder *ctx)
go_on = !ctx->halt && (ctx->videocount >= ctx->maxframes);
Mutex_Unlock(ctx->lock);
if (go_on)
usleep(10000);
sleepms(10);
} // while
//printf("Awake!\n");
} // if
Expand Down

0 comments on commit b79ceb2

Please sign in to comment.