diff test/testsem.c @ 1495:1dd8bf30a109

Might have fixed 64-bit issues. :)
author Sam Lantinga <slouken@libsdl.org>
date Sat, 11 Mar 2006 22:54:12 +0000
parents 4d3bb026cd16
children d5298e8f22b3
line wrap: on
line diff
--- a/test/testsem.c	Sat Mar 11 20:16:50 2006 +0000
+++ b/test/testsem.c	Sat Mar 11 22:54:12 2006 +0000
@@ -15,15 +15,16 @@
 
 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 @@
 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]);