test/torturethread.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 7678 286c42d7c5ed
     1.1 --- a/test/torturethread.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/torturethread.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -49,7 +49,7 @@
     1.4      int i;
     1.5      int tid = (int) (uintptr_t) data;
     1.6  
     1.7 -    fprintf(stderr, "Creating Thread %d\n", tid);
     1.8 +    SDL_Log("Creating Thread %d\n", tid);
     1.9  
    1.10      for (i = 0; i < NUMTHREADS; i++) {
    1.11          char name[64];
    1.12 @@ -58,18 +58,18 @@
    1.13          sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]);
    1.14      }
    1.15  
    1.16 -    printf("Thread '%d' waiting for signal\n", tid);
    1.17 +    SDL_Log("Thread '%d' waiting for signal\n", tid);
    1.18      while (time_for_threads_to_die[tid] != 1) {
    1.19          ;                       /* do nothing */
    1.20      }
    1.21  
    1.22 -    printf("Thread '%d' sending signals to subthreads\n", tid);
    1.23 +    SDL_Log("Thread '%d' sending signals to subthreads\n", tid);
    1.24      for (i = 0; i < NUMTHREADS; i++) {
    1.25          flags[i] = 1;
    1.26          SDL_WaitThread(sub_threads[i], NULL);
    1.27      }
    1.28  
    1.29 -    printf("Thread '%d' exiting!\n", tid);
    1.30 +    SDL_Log("Thread '%d' exiting!\n", tid);
    1.31  
    1.32      return 0;
    1.33  }
    1.34 @@ -80,9 +80,12 @@
    1.35      SDL_Thread *threads[NUMTHREADS];
    1.36      int i;
    1.37  
    1.38 +	/* Enable standard application logging */
    1.39 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.40 +
    1.41      /* Load the SDL library */
    1.42      if (SDL_Init(0) < 0) {
    1.43 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.44 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.45          return (1);
    1.46      }
    1.47  
    1.48 @@ -94,7 +97,7 @@
    1.49          threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i);
    1.50  
    1.51          if (threads[i] == NULL) {
    1.52 -            fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
    1.53 +            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
    1.54              quit(1);
    1.55          }
    1.56      }