21 #define NUM_THREADS 10 32 SDL_Log(
"Thread number %d has got the semaphore (value = %d)!\n",
36 SDL_Log(
"Thread number %d has released the semaphore (value = %d)!\n",
40 SDL_Log(
"Thread number %d exiting.\n", threadnum);
59 SDL_Log(
"Waiting 2 seconds on semaphore\n");
65 duration = end_ticks - start_ticks;
68 if (duration > 1900 && duration < 2050)
71 SDL_Log(
"Wait took %d milliseconds\n", duration);
79 main(
int argc,
char **argv)
89 SDL_Log(
"Usage: %s init_value\n", argv[0]);
101 init_sem = atoi(argv[1]);
109 SDL_snprintf(name,
sizeof (name),
"Thread%u", (
unsigned int) i);
117 SDL_Log(
"Waiting for threads to finish\n");
122 SDL_Log(
"Finished waiting for threads\n");
int ThreadFunc(void *data)
#define SDL_CreateSemaphore
int main(int argc, char **argv)
static void TestWaitTimeout(void)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
static void killed(int sig)
#define SDL_MUTEX_TIMEDOUT
GLuint const GLchar * name
#define SDL_SemWaitTimeout
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
#define SDL_LogSetPriority
static SDL_Thread * threads[6]
#define SDL_DestroySemaphore