main
| Line | |
|---|
| 1 | /* This file completes the definitions of types and some functions
|
|---|
| 2 | * for concurrency, which are declared in concurrency.cvh.
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #ifdef __CIVLC_CONCURRENCY__
|
|---|
| 6 | #else
|
|---|
| 7 | #define __CIVLC_CONCURRENCY__
|
|---|
| 8 |
|
|---|
| 9 | #include <concurrency.cvh>
|
|---|
| 10 |
|
|---|
| 11 | /* *********************** Types *********************** */
|
|---|
| 12 |
|
|---|
| 13 | /* A data type representing a global barrier which must be operated by local
|
|---|
| 14 | * barriers. Completes the declaration of this type in civlc-common.h.
|
|---|
| 15 | */
|
|---|
| 16 | struct __gbarrier__ {
|
|---|
| 17 | int nprocs;
|
|---|
| 18 | $proc proc_map[]; // initialized as all $proc_null.
|
|---|
| 19 | _Bool in_barrier[]; // initialized as all false.
|
|---|
| 20 | int num_in_barrier; // initialized as 0.
|
|---|
| 21 | };
|
|---|
| 22 |
|
|---|
| 23 | /* A data type representing a global barrier which used for
|
|---|
| 24 | * operating global barriers. The local barrier type has
|
|---|
| 25 | * a handle of a global barrier.
|
|---|
| 26 | * Completes the declaration of this type in civlc-common.h.
|
|---|
| 27 | */
|
|---|
| 28 | struct __barrier__ {
|
|---|
| 29 | int place;
|
|---|
| 30 | $gbarrier gbarrier; // initialized as 0.
|
|---|
| 31 | };
|
|---|
| 32 |
|
|---|
| 33 | /* *********************** Functions *********************** */
|
|---|
| 34 |
|
|---|
| 35 | void $barrier_enter($barrier barrier);
|
|---|
| 36 |
|
|---|
| 37 | void $barrier_exit($barrier barrier);
|
|---|
| 38 |
|
|---|
| 39 | void $barrier_call($barrier barrier) {
|
|---|
| 40 | $barrier_enter(barrier);
|
|---|
| 41 | $barrier_exit(barrier);
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.