• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #include <stdio.h>
3 #include <assert.h>
4 #include <pthread.h>
5 
main(void)6 int main ( void )
7 {
8    const int n = 100000;
9    int i, r;
10    pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER;
11    printf("begin %d lock--unlocks\n", n);
12    for (i = 0; i < n; i++) {
13       r =  pthread_mutex_lock(&mx);
14       r |= pthread_mutex_unlock(&mx);
15       assert(r == 0);
16    }
17    printf("done  %d lock--unlocks\n", n);
18    return 0;
19 }
20