test/testsem.c
changeset 6298 9110462bfc57
parent 5969 3a041d215edc
child 7191 75360622e65f
     1.1 --- a/test/testsem.c	Mon Feb 20 23:37:57 2012 -0500
     1.2 +++ b/test/testsem.c	Mon Feb 20 23:51:53 2012 -0500
     1.3 @@ -56,12 +56,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 @@ -71,6 +72,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