test/testsem.c
branchSDL-1.2
changeset 6297 c787fb1b5699
parent 5105 99acf3d856cb
     1.1 --- a/test/testsem.c	Mon Feb 20 20:55:23 2012 -0500
     1.2 +++ b/test/testsem.c	Mon Feb 20 23:51:08 2012 -0500
     1.3 @@ -38,12 +38,13 @@
     1.4  	Uint32 start_ticks;
     1.5  	Uint32 end_ticks;
     1.6  	Uint32 duration;
     1.7 +	int retval;
     1.8  
     1.9  	sem = SDL_CreateSemaphore(0);
    1.10  	printf("Waiting 2 seconds on semaphore\n");
    1.11  
    1.12  	start_ticks = SDL_GetTicks();
    1.13 -	SDL_SemWaitTimeout(sem, 2000);
    1.14 +	retval = SDL_SemWaitTimeout(sem, 2000);
    1.15  	end_ticks = SDL_GetTicks();
    1.16  
    1.17  	duration = end_ticks - start_ticks;
    1.18 @@ -53,6 +54,10 @@
    1.19  		printf("Wait done.\n");
    1.20  	else
    1.21  		fprintf(stderr, "Wait took %d milliseconds\n", duration);
    1.22 +	
    1.23 +	/* Check to make sure the return value indicates timed out */
    1.24 +	if (retval != SDL_MUTEX_TIMEDOUT) 
    1.25 +		fprintf(stderr, "SDL_SemWaitTimeout returned: %d; expected: %d\n", retval, SDL_MUTEX_TIMEDOUT);
    1.26  }
    1.27  
    1.28  int main(int argc, char **argv)