~brandontschaefer/libsdl/enable-mir-support-ffe

« back to all changes in this revision

Viewing changes to test/torturethread.c

  • Committer: Package Import Robot
  • Author(s): Manuel A. Fernandez Montecelo, Felix Geyer
  • Date: 2013-12-28 12:31:19 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20131228123119-e0k27gckmnzskfgb
Tags: 2.0.1+dfsg1-1
* New upstream release (Closes: #728974)
  - Remove patch applied upstream:
    bug-723797-false_positives_in_mouse_wheel_code.patch
* Bump Standards-Version to 3.9.5, no changes needed.

[ Felix Geyer ]
* Import upstream gpg key for uscan to verify the orig tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
SubThreadFunc(void *data)
37
37
{
38
38
    while (!*(int volatile *) data) {
39
 
        ;                       /*SDL_Delay(10); *//* do nothing */
 
39
        ;                       /* SDL_Delay(10); *//* do nothing */
40
40
    }
41
41
    return 0;
42
42
}
49
49
    int i;
50
50
    int tid = (int) (uintptr_t) data;
51
51
 
52
 
    fprintf(stderr, "Creating Thread %d\n", tid);
 
52
    SDL_Log("Creating Thread %d\n", tid);
53
53
 
54
54
    for (i = 0; i < NUMTHREADS; i++) {
55
55
        char name[64];
58
58
        sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]);
59
59
    }
60
60
 
61
 
    printf("Thread '%d' waiting for signal\n", tid);
 
61
    SDL_Log("Thread '%d' waiting for signal\n", tid);
62
62
    while (time_for_threads_to_die[tid] != 1) {
63
63
        ;                       /* do nothing */
64
64
    }
65
65
 
66
 
    printf("Thread '%d' sending signals to subthreads\n", tid);
 
66
    SDL_Log("Thread '%d' sending signals to subthreads\n", tid);
67
67
    for (i = 0; i < NUMTHREADS; i++) {
68
68
        flags[i] = 1;
69
69
        SDL_WaitThread(sub_threads[i], NULL);
70
70
    }
71
71
 
72
 
    printf("Thread '%d' exiting!\n", tid);
 
72
    SDL_Log("Thread '%d' exiting!\n", tid);
73
73
 
74
74
    return 0;
75
75
}
80
80
    SDL_Thread *threads[NUMTHREADS];
81
81
    int i;
82
82
 
 
83
        /* Enable standard application logging */
 
84
    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
85
 
83
86
    /* Load the SDL library */
84
87
    if (SDL_Init(0) < 0) {
85
 
        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
 
88
        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
86
89
        return (1);
87
90
    }
88
91
 
94
97
        threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i);
95
98
 
96
99
        if (threads[i] == NULL) {
97
 
            fprintf(stderr, "Couldn't create thread: %s\n", SDL_GetError());
 
100
            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
98
101
            quit(1);
99
102
        }
100
103
    }