test/testlock.c
changeset 1151 be9c9c8f6d53
parent 0 74212992fb08
child 1659 14717b52abc0
equal deleted inserted replaced
1150:7d8e1925f35b 1151:be9c9c8f6d53
    12 #include "SDL_thread.h"
    12 #include "SDL_thread.h"
    13 
    13 
    14 static SDL_mutex *mutex = NULL;
    14 static SDL_mutex *mutex = NULL;
    15 static Uint32 mainthread;
    15 static Uint32 mainthread;
    16 static SDL_Thread *threads[6];
    16 static SDL_Thread *threads[6];
       
    17 
       
    18 /*
       
    19  * SDL_Quit() shouldn't be used with atexit() directly because
       
    20  *  calling conventions may differ...
       
    21  */
       
    22 static void SDL_Quit_Wrapper(void)
       
    23 {
       
    24 	SDL_Quit();
       
    25 }
    17 
    26 
    18 void printid(void)
    27 void printid(void)
    19 {
    28 {
    20 	printf("Process %u:  exiting\n", SDL_ThreadID());
    29 	printf("Process %u:  exiting\n", SDL_ThreadID());
    21 }
    30 }
    66 	/* Load the SDL library */
    75 	/* Load the SDL library */
    67 	if ( SDL_Init(0) < 0 ) {
    76 	if ( SDL_Init(0) < 0 ) {
    68 		fprintf(stderr, "%s\n", SDL_GetError());
    77 		fprintf(stderr, "%s\n", SDL_GetError());
    69 		exit(1);
    78 		exit(1);
    70 	}
    79 	}
    71 	atexit(SDL_Quit);
    80 	atexit(SDL_Quit_Wrapper);
    72 
    81 
    73 	if ( (mutex=SDL_CreateMutex()) == NULL ) {
    82 	if ( (mutex=SDL_CreateMutex()) == NULL ) {
    74 		fprintf(stderr, "Couldn't create mutex: %s\n", SDL_GetError());
    83 		fprintf(stderr, "Couldn't create mutex: %s\n", SDL_GetError());
    75 		exit(1);
    84 		exit(1);
    76 	}
    85 	}