test/testsem.c
branchSDL-1.2
changeset 6297 c787fb1b5699
parent 5105 99acf3d856cb
--- a/test/testsem.c	Mon Feb 20 20:55:23 2012 -0500
+++ b/test/testsem.c	Mon Feb 20 23:51:08 2012 -0500
@@ -38,12 +38,13 @@
 	Uint32 start_ticks;
 	Uint32 end_ticks;
 	Uint32 duration;
+	int retval;
 
 	sem = SDL_CreateSemaphore(0);
 	printf("Waiting 2 seconds on semaphore\n");
 
 	start_ticks = SDL_GetTicks();
-	SDL_SemWaitTimeout(sem, 2000);
+	retval = SDL_SemWaitTimeout(sem, 2000);
 	end_ticks = SDL_GetTicks();
 
 	duration = end_ticks - start_ticks;
@@ -53,6 +54,10 @@
 		printf("Wait done.\n");
 	else
 		fprintf(stderr, "Wait took %d milliseconds\n", duration);
+	
+	/* Check to make sure the return value indicates timed out */
+	if (retval != SDL_MUTEX_TIMEDOUT) 
+		fprintf(stderr, "SDL_SemWaitTimeout returned: %d; expected: %d\n", retval, SDL_MUTEX_TIMEDOUT);
 }
 
 int main(int argc, char **argv)