From 8b92cc6af9a5674709d18cc909300ac7b841b46d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 11 Mar 2006 22:54:12 +0000 Subject: [PATCH] Might have fixed 64-bit issues. :) --- test/testsem.c | 10 ++++++---- test/torturethread.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/test/testsem.c b/test/testsem.c index 9034220b8..f0a985991 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -15,15 +15,16 @@ int alive = 1; int ThreadFunc(void *data) { + uintptr_t threadnum = (uintptr_t)data; while ( alive ) { SDL_SemWait(sem); - fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", (int)data, SDL_SemValue(sem)); + fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem)); SDL_Delay(200); SDL_SemPost(sem); - fprintf(stderr, "Thread number %d has released the semaphore (value = %d)!\n", (int)data, SDL_SemValue(sem)); + fprintf(stderr, "Thread number %d has released the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem)); SDL_Delay(1); /* For the scheduler */ } - printf("Thread number %d exiting.\n", (int)data); + printf("Thread number %d exiting.\n", threadnum); return 0; } @@ -35,7 +36,8 @@ static void killed(int sig) int main(int argc, char **argv) { SDL_Thread *threads[NUM_THREADS]; - int i, init_sem; + uintptr_t i; + int init_sem; if(argc < 2) { fprintf(stderr,"Usage: %s init_value\n", argv[0]); diff --git a/test/torturethread.c b/test/torturethread.c index b12d9cf51..d85b48f0e 100644 --- a/test/torturethread.c +++ b/test/torturethread.c @@ -31,7 +31,7 @@ int ThreadFunc(void *data) { SDL_Thread *sub_threads[NUMTHREADS]; int flags[NUMTHREADS]; int i; - int tid = (int ) data; + uintptr_t tid = (uintptr_t)data; fprintf(stderr, "Creating Thread %d\n", tid); @@ -59,7 +59,7 @@ int ThreadFunc(void *data) { int main(int argc, char *argv[]) { SDL_Thread *threads[NUMTHREADS]; - int i; + uintptr_t i; /* Load the SDL library */ if ( SDL_Init(0) < 0 ) {