| 35 | } |
| 36 | |
| 37 | void *ThreadMain(void *arg) { |
| 38 | pthread_mutex_lock(&lock); |
| 39 | int c = counter; |
| 40 | sleepms(100); // Create contention on the lock. |
| 41 | ++c; |
| 42 | counter = c; |
| 43 | pthread_mutex_unlock(&lock); |
| 44 | pthread_exit(0); |
| 45 | } |
| 46 | |
| 47 | void CreateThread(int i, int n) { |
| 48 | pthread_attr_t attr; |