test/torturethread.c
branchSDL-1.3
changeset 1668 4da1ee79c9af
parent 1662 782fd950bd46
     1.1 --- a/test/torturethread.c	Mon May 29 03:53:21 2006 +0000
     1.2 +++ b/test/torturethread.c	Mon May 29 04:04:35 2006 +0000
     1.3 @@ -15,14 +15,14 @@
     1.4  
     1.5  /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
     1.6  static void
     1.7 -quit (int rc)
     1.8 +quit(int rc)
     1.9  {
    1.10 -    SDL_Quit ();
    1.11 -    exit (rc);
    1.12 +    SDL_Quit();
    1.13 +    exit(rc);
    1.14  }
    1.15  
    1.16  int SDLCALL
    1.17 -SubThreadFunc (void *data)
    1.18 +SubThreadFunc(void *data)
    1.19  {
    1.20      while (!*(int volatile *) data) {
    1.21          ;                       /*SDL_Delay(10); *//* do nothing */
    1.22 @@ -31,56 +31,56 @@
    1.23  }
    1.24  
    1.25  int SDLCALL
    1.26 -ThreadFunc (void *data)
    1.27 +ThreadFunc(void *data)
    1.28  {
    1.29      SDL_Thread *sub_threads[NUMTHREADS];
    1.30      int flags[NUMTHREADS];
    1.31      int i;
    1.32      int tid = (int) (uintptr_t) data;
    1.33  
    1.34 -    fprintf (stderr, "Creating Thread %d\n", tid);
    1.35 +    fprintf(stderr, "Creating Thread %d\n", tid);
    1.36  
    1.37      for (i = 0; i < NUMTHREADS; i++) {
    1.38          flags[i] = 0;
    1.39 -        sub_threads[i] = SDL_CreateThread (SubThreadFunc, &flags[i]);
    1.40 +        sub_threads[i] = SDL_CreateThread(SubThreadFunc, &flags[i]);
    1.41      }
    1.42  
    1.43 -    printf ("Thread '%d' waiting for signal\n", tid);
    1.44 +    printf("Thread '%d' waiting for signal\n", tid);
    1.45      while (time_for_threads_to_die[tid] != 1) {
    1.46          ;                       /* do nothing */
    1.47      }
    1.48  
    1.49 -    printf ("Thread '%d' sending signals to subthreads\n", tid);
    1.50 +    printf("Thread '%d' sending signals to subthreads\n", tid);
    1.51      for (i = 0; i < NUMTHREADS; i++) {
    1.52          flags[i] = 1;
    1.53 -        SDL_WaitThread (sub_threads[i], NULL);
    1.54 +        SDL_WaitThread(sub_threads[i], NULL);
    1.55      }
    1.56  
    1.57 -    printf ("Thread '%d' exiting!\n", tid);
    1.58 +    printf("Thread '%d' exiting!\n", tid);
    1.59  
    1.60      return 0;
    1.61  }
    1.62  
    1.63  int
    1.64 -main (int argc, char *argv[])
    1.65 +main(int argc, char *argv[])
    1.66  {
    1.67      SDL_Thread *threads[NUMTHREADS];
    1.68      int i;
    1.69  
    1.70      /* Load the SDL library */
    1.71 -    if (SDL_Init (0) < 0) {
    1.72 -        fprintf (stderr, "Couldn't initialize SDL: %s\n", SDL_GetError ());
    1.73 +    if (SDL_Init(0) < 0) {
    1.74 +        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.75          return (1);
    1.76      }
    1.77  
    1.78 -    signal (SIGSEGV, SIG_DFL);
    1.79 +    signal(SIGSEGV, SIG_DFL);
    1.80      for (i = 0; i < NUMTHREADS; i++) {
    1.81          time_for_threads_to_die[i] = 0;
    1.82 -        threads[i] = SDL_CreateThread (ThreadFunc, (void *) (uintptr_t) i);
    1.83 +        threads[i] = SDL_CreateThread(ThreadFunc, (void *) (uintptr_t) i);
    1.84  
    1.85          if (threads[i] == NULL) {
    1.86 -            fprintf (stderr, "Couldn't create thread: %s\n", SDL_GetError ());
    1.87 -            quit (1);
    1.88 +            fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
    1.89 +            quit(1);
    1.90          }
    1.91      }
    1.92  
    1.93 @@ -89,8 +89,8 @@
    1.94      }
    1.95  
    1.96      for (i = 0; i < NUMTHREADS; i++) {
    1.97 -        SDL_WaitThread (threads[i], NULL);
    1.98 +        SDL_WaitThread(threads[i], NULL);
    1.99      }
   1.100 -    SDL_Quit ();
   1.101 +    SDL_Quit();
   1.102      return (0);
   1.103  }