1 /* Simple test code with no bug */
8 static void* thread1_fun(void* ignore)
10 pthread_mutex_lock(&mutex);
11 pthread_mutex_unlock(&mutex);
15 static void* thread2_fun(void* ignore)
17 pthread_mutex_lock(&mutex);
18 pthread_mutex_unlock(&mutex);
23 int main(int argc, char* argv[])
25 fprintf(stderr, "User main is starting\n");
27 pthread_mutex_init(&mutex, NULL);
29 pthread_t thread1, thread2;
30 pthread_create(&thread1, NULL, thread1_fun, NULL);
31 fprintf(stderr, "here\n");
32 pthread_create(&thread2, NULL, thread2_fun, NULL);
33 fprintf(stderr, "there\n");
34 pthread_join(thread1, NULL);
35 pthread_join(thread2, NULL);
37 fprintf(stderr, "User main is done\n");