github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/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  }