1.3 API CHANGE: Add support for naming threads.
--HG-- extra : rebase_source : ae532d4b4d68ef86de0fc2cb6794a622e0841bce
This commit is contained in:
parent
dead491b27
commit
0863dee582
22 changed files with 183 additions and 45 deletions
|
@ -52,8 +52,10 @@ ThreadFunc(void *data)
|
|||
fprintf(stderr, "Creating Thread %d\n", tid);
|
||||
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "Child%d_%d", tid, i);
|
||||
flags[i] = 0;
|
||||
sub_threads[i] = SDL_CreateThread(SubThreadFunc, &flags[i]);
|
||||
sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]);
|
||||
}
|
||||
|
||||
printf("Thread '%d' waiting for signal\n", tid);
|
||||
|
@ -86,8 +88,10 @@ main(int argc, char *argv[])
|
|||
|
||||
signal(SIGSEGV, SIG_DFL);
|
||||
for (i = 0; i < NUMTHREADS; i++) {
|
||||
char name[64];
|
||||
SDL_snprintf(name, sizeof (name), "Parent%d", i);
|
||||
time_for_threads_to_die[i] = 0;
|
||||
threads[i] = SDL_CreateThread(ThreadFunc, (void *) (uintptr_t) i);
|
||||
threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i);
|
||||
|
||||
if (threads[i] == NULL) {
|
||||
fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue