| 1 | /* This header file contains the function prototypes for
|
|---|
| 2 | * concurrency.
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #ifdef __CONCURRENCY__
|
|---|
| 6 | #else
|
|---|
| 7 | #define __CONCURRENCY__
|
|---|
| 8 |
|
|---|
| 9 | /* includes civlc.cvh because this library references $scope */
|
|---|
| 10 | #include <civlc.cvh>
|
|---|
| 11 |
|
|---|
| 12 | /* ********************************* Types ********************************* */
|
|---|
| 13 |
|
|---|
| 14 | /* A data type representing a global barrier which must be operated by local
|
|---|
| 15 | * barriers.
|
|---|
| 16 | */
|
|---|
| 17 | typedef struct __gbarrier__ * $gbarrier;
|
|---|
| 18 |
|
|---|
| 19 | /* A data type representing a global barrier which used for
|
|---|
| 20 | * operating global barriers. The local barrier type has
|
|---|
| 21 | * a handle of a global barrier.
|
|---|
| 22 | */
|
|---|
| 23 | typedef struct __barrier__ * $barrier;
|
|---|
| 24 |
|
|---|
| 25 | /* ******************************* Functions ******************************* */
|
|---|
| 26 |
|
|---|
| 27 | /* Creates a new barrier object and returns a handle to it.
|
|---|
| 28 | * The barrier has the specified size.
|
|---|
| 29 | * The new object will be allocated in the given scope. */
|
|---|
| 30 | $gbarrier $gbarrier_create($scope scope, int size);
|
|---|
| 31 |
|
|---|
| 32 | /* Destroys the gbarrier */
|
|---|
| 33 | void $gbarrier_destroy($gbarrier barrier);
|
|---|
| 34 |
|
|---|
| 35 | /* Creates a new local barrier object and returns a handle to it.
|
|---|
| 36 | * The new barrier will be affiliated with the specified global
|
|---|
| 37 | * barrier. This local barrier handle will be used as an
|
|---|
| 38 | * argument in most barrier functions. The place must be in
|
|---|
| 39 | * [0,size-1] and specifies the place in the global barrier
|
|---|
| 40 | * that will be occupied by the local barrier.
|
|---|
| 41 | * Only one call to $barrier_create may occur for each barrier-place pair.
|
|---|
| 42 | * The new object will be allocated in the given scope. */
|
|---|
| 43 | $barrier $barrier_create($scope scope, $gbarrier gbarrier, int place);
|
|---|
| 44 |
|
|---|
| 45 | /* Destroys the barrier. */
|
|---|
| 46 | void $barrier_destroy($barrier barrier);
|
|---|
| 47 |
|
|---|
| 48 | /* Calls the barrier associated with this local barrier object.*/
|
|---|
| 49 | void $barrier_call($barrier barrier);
|
|---|
| 50 |
|
|---|
| 51 | #endif
|
|---|