1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include <pthread.h>
|
|---|
| 2 |
|
|---|
| 3 | void __VERIFIER_assert(int expression) { if (!expression) { ERROR: goto ERROR; }; return; }
|
|---|
| 4 |
|
|---|
| 5 | int i=1, j=1;
|
|---|
| 6 |
|
|---|
| 7 | #define NUM 11
|
|---|
| 8 |
|
|---|
| 9 | void *
|
|---|
| 10 | t1(void* arg)
|
|---|
| 11 | {
|
|---|
| 12 | int k = 0;
|
|---|
| 13 |
|
|---|
| 14 | for (k = 0; k < NUM; k++)
|
|---|
| 15 | i+=j;
|
|---|
| 16 |
|
|---|
| 17 | pthread_exit(NULL);
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | void *
|
|---|
| 21 | t2(void* arg)
|
|---|
| 22 | {
|
|---|
| 23 | int k = 0;
|
|---|
| 24 |
|
|---|
| 25 | for (k = 0; k < NUM; k++)
|
|---|
| 26 | j+=i;
|
|---|
| 27 |
|
|---|
| 28 | pthread_exit(NULL);
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | int
|
|---|
| 32 | main(int argc, char **argv)
|
|---|
| 33 | {
|
|---|
| 34 | pthread_t id1, id2;
|
|---|
| 35 |
|
|---|
| 36 | pthread_create(&id1, NULL, t1, NULL);
|
|---|
| 37 | pthread_create(&id2, NULL, t2, NULL);
|
|---|
| 38 |
|
|---|
| 39 | pthread_join(id1, 0);
|
|---|
| 40 | pthread_join(id2, 0);
|
|---|
| 41 |
|
|---|
| 42 | printf(" %d \n", i);
|
|---|
| 43 | printf(" %d \n", j);
|
|---|
| 44 | if (i >= 46368 || j >= 46368) {
|
|---|
| 45 | ERROR:
|
|---|
| 46 | goto ERROR;
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | return 0;
|
|---|
| 50 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.