main
test-branch
|
Last change
on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
695 bytes
|
| Line | |
|---|
| 1 | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
|
|---|
| 2 |
|
|---|
| 3 | #include <pthread.h>
|
|---|
| 4 |
|
|---|
| 5 | void __VERIFIER_assert(int expression) { if (!expression) { ERROR: __VERIFIER_error();}; return; }
|
|---|
| 6 |
|
|---|
| 7 | int i=1, j=1;
|
|---|
| 8 |
|
|---|
| 9 | #define NUM 11
|
|---|
| 10 |
|
|---|
| 11 | void *
|
|---|
| 12 | t1(void* arg)
|
|---|
| 13 | {
|
|---|
| 14 | int k = 0;
|
|---|
| 15 |
|
|---|
| 16 | for (k = 0; k < NUM; k++)
|
|---|
| 17 | i+=j;
|
|---|
| 18 |
|
|---|
| 19 | pthread_exit(NULL);
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | void *
|
|---|
| 23 | t2(void* arg)
|
|---|
| 24 | {
|
|---|
| 25 | int k = 0;
|
|---|
| 26 |
|
|---|
| 27 | for (k = 0; k < NUM; k++)
|
|---|
| 28 | j+=i;
|
|---|
| 29 |
|
|---|
| 30 | pthread_exit(NULL);
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | int
|
|---|
| 34 | main(int argc, char **argv)
|
|---|
| 35 | {
|
|---|
| 36 | pthread_t id1, id2;
|
|---|
| 37 |
|
|---|
| 38 | pthread_create(&id1, NULL, t1, NULL);
|
|---|
| 39 | pthread_create(&id2, NULL, t2, NULL);
|
|---|
| 40 | pthread_join(id1, NULL);
|
|---|
| 41 | pthread_join(id2, NULL);
|
|---|
| 42 | if (i >= 46368 || j >= 46368) {
|
|---|
| 43 | ERROR: __VERIFIER_error();
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | return 0;
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.