3 #define _XOPEN_SOURCE 500
9 static pthread_mutex_t mutex;
13 static void make_mutex(
void)
15 static pthread_mutex_t t_mutex = PTHREAD_MUTEX_INITIALIZER;
16 static int initialized;
17 pthread_mutexattr_t attr;
22 pthread_mutex_lock(&t_mutex);
25 pthread_mutex_unlock(&t_mutex);
29 pthread_mutexattr_init(&attr);
30 pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
31 pthread_mutex_init(&mutex, &attr);
34 pthread_mutex_unlock(&t_mutex);
51 pthread_mutex_lock(&mutex);
55 pthread_mutex_unlock(&mutex);
67 pthread_mutex_lock(&mutex);
70 pthread_mutex_unlock(&mutex);
82 pthread_mutex_unlock(&mutex);
void G_initialize_done(int *p)
void G_init_counter(struct Counter *c, int v)
int G_is_initialized(int *p)
int G_counter_next(struct Counter *c)