comparison test/testhread.c @ 2779:4436464c4f51

Fixed Bugzilla bug #205 Removed SDL_KillThread() from the API, as it isn't safe on many platforms.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 24 Nov 2008 00:18:42 +0000
parents c121d94672cb
children 0d1b16ee0bca
comparison
equal deleted inserted replaced
2778:38dfc890ee6b 2779:4436464c4f51
61 printf("Waiting for thread #1\n"); 61 printf("Waiting for thread #1\n");
62 alive = 0; 62 alive = 0;
63 SDL_WaitThread(thread, NULL); 63 SDL_WaitThread(thread, NULL);
64 64
65 alive = 1; 65 alive = 1;
66 signal(SIGTERM, killed);
66 thread = SDL_CreateThread(ThreadFunc, "#2"); 67 thread = SDL_CreateThread(ThreadFunc, "#2");
67 if (thread == NULL) {
68 fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
69 quit(1);
70 }
71 SDL_Delay(5 * 1000);
72 printf("Killing thread #2\n");
73 SDL_KillThread(thread);
74
75 alive = 1;
76 signal(SIGTERM, killed);
77 thread = SDL_CreateThread(ThreadFunc, "#3");
78 if (thread == NULL) { 68 if (thread == NULL) {
79 fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError()); 69 fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
80 quit(1); 70 quit(1);
81 } 71 }
82 raise(SIGTERM); 72 raise(SIGTERM);