SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
2 /* Simple test of the SDL threading code and error handling */
9 #include "SDL_thread.h"
13 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
22 ThreadFunc(void *data)
24 /* Set the child thread error string */
25 SDL_SetError("Thread %s (%d) had a problem: %s",
26 (char *) data, SDL_ThreadID(), "nevermind");
28 printf("Thread '%s' is alive!\n", (char *) data);
31 printf("Child thread error string: %s\n", SDL_GetError());
36 main(int argc, char *argv[])
40 /* Load the SDL library */
41 if (SDL_Init(0) < 0) {
42 fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
46 /* Set the error value for the main thread */
47 SDL_SetError("No worries");
50 thread = SDL_CreateThread(ThreadFunc, "#1");
52 fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
56 printf("Waiting for thread #1\n");
58 SDL_WaitThread(thread, NULL);
60 printf("Main thread error string: %s\n", SDL_GetError());