test/testsem.c
changeset 1769 290b5baf2fca
parent 1615 d5298e8f22b3
child 1662 782fd950bd46
child 1895 c121d94672cb
child 5105 99acf3d856cb
equal deleted inserted replaced
1768:814f9f2c7a33 1769:290b5baf2fca
    11 #define NUM_THREADS 10
    11 #define NUM_THREADS 10
    12 
    12 
    13 static SDL_sem *sem;
    13 static SDL_sem *sem;
    14 int alive = 1;
    14 int alive = 1;
    15 
    15 
    16 int ThreadFunc(void *data)
    16 int SDLCALL ThreadFunc(void *data)
    17 {
    17 {
    18 	int threadnum = (int)(uintptr_t)data;
    18 	int threadnum = (int)(uintptr_t)data;
    19 	while ( alive ) {
    19 	while ( alive ) {
    20 		SDL_SemWait(sem);
    20 		SDL_SemWait(sem);
    21 		fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem));
    21 		fprintf(stderr, "Thread number %d has got the semaphore (value = %d)!\n", threadnum, SDL_SemValue(sem));