Might have fixed 64-bit issues. :)
authorSam Lantinga <slouken@libsdl.org>
Sat, 11 Mar 2006 22:54:12 +0000
changeset 14951dd8bf30a109
parent 1494 4da1926c287c
child 1496 405e20dc004c
Might have fixed 64-bit issues. :)
test/testsem.c
test/torturethread.c
     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]);
     2.1 --- a/test/torturethread.c	Sat Mar 11 20:16:50 2006 +0000
     2.2 +++ b/test/torturethread.c	Sat Mar 11 22:54:12 2006 +0000
     2.3 @@ -31,7 +31,7 @@
     2.4  	SDL_Thread *sub_threads[NUMTHREADS];
     2.5  	int flags[NUMTHREADS];
     2.6  	int i;
     2.7 -	int tid = (int ) data;
     2.8 +	uintptr_t tid = (uintptr_t)data;
     2.9  
    2.10  	fprintf(stderr, "Creating Thread %d\n", tid);
    2.11  
    2.12 @@ -59,7 +59,7 @@
    2.13  int main(int argc, char *argv[])
    2.14  {
    2.15  	SDL_Thread *threads[NUMTHREADS];
    2.16 -	int i;
    2.17 +	uintptr_t i;
    2.18  
    2.19  	/* Load the SDL library */
    2.20  	if ( SDL_Init(0) < 0 ) {