source:
CIVL/mods/dev.civl.com/examples/experimental/pthreadTransformerTest.cvl@
cb4d4f4
| Last change on this file since cb4d4f4 was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 309 bytes | |
| Line | |
|---|---|
| 1 | #include <pthread.h> |
| 2 | |
| 3 | #define ARRAYSIZE 1000 |
| 4 | |
| 5 | pthread_mutex_t count_mutex; |
| 6 | |
| 7 | int a[ARRAYSIZE]; |
| 8 | int count = 0; |
| 9 | |
| 10 | int main(){ |
| 11 | int ret_count = pthread_mutex_init(&count_mutex, NULL); |
| 12 | pthread_mutex_lock (&count_mutex); |
| 13 | count = count + 1; |
| 14 | pthread_mutex_unlock (&count_mutex); |
| 15 | a[0] = count; |
| 16 | return a[0]; |
| 17 | } |
Note:
See TracBrowser
for help on using the repository browser.
