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);
50 pthread_mutex_lock(&mutex);
54 pthread_mutex_unlock(&mutex);
66 pthread_mutex_lock(&mutex);
69 pthread_mutex_unlock(&mutex);
81 pthread_mutex_unlock(&mutex);
void G_init_counter(struct Counter *c, int v)
int G_is_initialized(int *p)
void G_initialize_done(int *p)
int G_counter_next(struct Counter *c)