test/testsem.c
changeset 1495 1dd8bf30a109
parent 1439 4d3bb026cd16
child 1615 d5298e8f22b3
     1.1 --- a/test/testsem.c	Sat Mar 11 20:16:50 2006 +0000
     1.2 +++ b/test/testsem.c	Sat Mar 11 22:54:12 2006 +0000
     1.3 @@ -15,15 +15,16 @@
     1.4  
     1.5  int ThreadFunc(void *data)
     1.6  {
     1.7 +	uintptr_t threadnum = (uintptr_t)data;
     1.8  	while ( alive ) {
     1.9  		SDL_SemWait(sem);
    1.10 -		fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", (int)data, SDL_SemValue(sem));
    1.11 +		fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem));
    1.12  		SDL_Delay(200);
    1.13  		SDL_SemPost(sem);
    1.14 -		fprintf(stderr, "Thread number %d has released the semaphore (value = %d)!\n", (int)data, SDL_SemValue(sem));
    1.15 +		fprintf(stderr, "Thread number %d has released the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem));
    1.16  		SDL_Delay(1); /* For the scheduler */
    1.17  	}
    1.18 -	printf("Thread number %d exiting.\n", (int)data);
    1.19 +	printf("Thread number %d exiting.\n", threadnum);
    1.20  	return 0;
    1.21  }
    1.22  
    1.23 @@ -35,7 +36,8 @@
    1.24  int main(int argc, char **argv)
    1.25  {
    1.26  	SDL_Thread *threads[NUM_THREADS];
    1.27 -	int i, init_sem;
    1.28 +	uintptr_t i;
    1.29 +	int init_sem;
    1.30  
    1.31  	if(argc < 2) {
    1.32  		fprintf(stderr,"Usage: %s init_value\n", argv[0]);