WinRT: made testthread log output via SDL_Log
authorDavid Ludwig <dludwig@pobox.com>
Tue, 20 Aug 2013 21:55:13 -0400
changeset 8485f0ede9ce6a44
parent 8484 7258989352eb
child 8486 ba33d06f80cd
WinRT: made testthread log output via SDL_Log
- this will allow output to be read via Visual C++'s Output pane
test/testthread.c
     1.1 --- a/test/testthread.c	Tue Aug 20 21:54:34 2013 -0400
     1.2 +++ b/test/testthread.c	Tue Aug 20 21:55:13 2013 -0400
     1.3 @@ -34,20 +34,20 @@
     1.4  ThreadFunc(void *data)
     1.5  {
     1.6      SDL_TLSSet(tls, "baby thread", NULL);
     1.7 -    printf("Started thread %s: My thread id is %lu, thread data = %s\n",
     1.8 +    SDL_Log("Started thread %s: My thread id is %lu, thread data = %s\n",
     1.9             (char *) data, SDL_ThreadID(), (const char *)SDL_TLSGet(tls));
    1.10      while (alive) {
    1.11 -        printf("Thread '%s' is alive!\n", (char *) data);
    1.12 +        SDL_Log("Thread '%s' is alive!\n", (char *) data);
    1.13          SDL_Delay(1 * 1000);
    1.14      }
    1.15 -    printf("Thread '%s' exiting!\n", (char *) data);
    1.16 +    SDL_Log("Thread '%s' exiting!\n", (char *) data);
    1.17      return (0);
    1.18  }
    1.19  
    1.20  static void
    1.21  killed(int sig)
    1.22  {
    1.23 -    printf("Killed with SIGTERM, waiting 5 seconds to exit\n");
    1.24 +    SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit\n");
    1.25      SDL_Delay(5 * 1000);
    1.26      alive = 0;
    1.27      quit(0);
    1.28 @@ -60,33 +60,33 @@
    1.29  
    1.30      /* Load the SDL library */
    1.31      if (SDL_Init(0) < 0) {
    1.32 -        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    1.33 +        SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError());
    1.34          return (1);
    1.35      }
    1.36  
    1.37      tls = SDL_TLSCreate();
    1.38      SDL_assert(tls);
    1.39      SDL_TLSSet(tls, "main thread", NULL);
    1.40 -    printf("Main thread data initially: %s\n", (const char *)SDL_TLSGet(tls));
    1.41 +    SDL_Log("Main thread data initially: %s\n", (const char *)SDL_TLSGet(tls));
    1.42  
    1.43      alive = 1;
    1.44      thread = SDL_CreateThread(ThreadFunc, "One", "#1");
    1.45      if (thread == NULL) {
    1.46 -        fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
    1.47 +        SDL_Log("Couldn't create thread: %s\n", SDL_GetError());
    1.48          quit(1);
    1.49      }
    1.50      SDL_Delay(5 * 1000);
    1.51 -    printf("Waiting for thread #1\n");
    1.52 +    SDL_Log("Waiting for thread #1\n");
    1.53      alive = 0;
    1.54      SDL_WaitThread(thread, NULL);
    1.55  
    1.56 -    printf("Main thread data finally: %s\n", (const char *)SDL_TLSGet(tls));
    1.57 +    SDL_Log("Main thread data finally: %s\n", (const char *)SDL_TLSGet(tls));
    1.58  
    1.59      alive = 1;
    1.60      signal(SIGTERM, killed);
    1.61      thread = SDL_CreateThread(ThreadFunc, "Two", "#2");
    1.62      if (thread == NULL) {
    1.63 -        fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
    1.64 +        SDL_Log("Couldn't create thread: %s\n", SDL_GetError());
    1.65          quit(1);
    1.66      }
    1.67      raise(SIGTERM);