github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/experimental/testdata/pthread.c (about) 1 #include <pthread.h> 2 3 pthread_mutex_t mutex; 4 int count = 0; 5 6 void run() { 7 pthread_mutex_lock(&mutex); 8 count++; 9 pthread_mutex_unlock(&mutex); 10 } 11 12 int get() { 13 int res; 14 pthread_mutex_lock(&mutex); 15 res = count; 16 pthread_mutex_unlock(&mutex); 17 return res; 18 }