11 static void* a(void *obj)
16 pthread_mutex_lock(&m);
17 store_32(&shareddata,(unsigned int)i);
18 printf("shareddata: %d\n", shareddata);
19 pthread_mutex_unlock(&m);
21 while(!pthread_mutex_trylock(&m))
23 store_32(&shareddata,(unsigned int)i);
24 printf("shareddata: %d\n", shareddata);
25 pthread_mutex_unlock(&m);
30 int user_main(int argc, char **argv)
33 pthread_mutex_init(&m, NULL);
35 thrd_create(&t1, (thrd_start_t)&a, NULL);
36 thrd_create(&t2, (thrd_start_t)&a, NULL);