12 using namespace forest;
14 void* f(
void* start) {
15 int i = *((
int *) start);
16 while (i < 10000000) {
17 pthread_mutex_lock(&clok);
18 if (lockCount != i) { pthread_mutex_unlock(&clok);
continue; }
20 pthread_mutex_unlock(&clok);
31 pthread_create(&t0,NULL,f,(
void *) &zero);
32 pthread_create(&t1,NULL,f,(
void *) &one);
34 pthread_join(t0,NULL); pthread_join(t1,NULL);