source: CIVL/include/headers/concurrency.cvh@ 1aaefd4

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: 2.5 KB
Line 
1/* This header file contains the function prototypes for
2 * concurrency.
3 */
4
5#ifndef _CONCURRENCY_
6#define _CONCURRENCY_
7
8/* includes civlc.cvh because this library references $scope */
9#include <civlc.cvh>
10#include <bundle.cvh>
11#pragma CIVL ACSL
12/* ********************************* Types ********************************* */
13
14/* A data type representing a global barrier which must be operated by local
15 * barriers.
16 */
17typedef 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 */
23typedef 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/*@ depends_on \nothing;
31 @ assigns \nothing;
32 @ reads \nothing;
33 @ */
34$atomic_f $gbarrier $gbarrier_create($scope scope, int size);
35
36/* Destroys the gbarrier */
37/*@ depends_on \access(gbarrier);
38 @ reads \nothing;
39 @ assigns gbarrier;
40 @ */
41$atomic_f void $gbarrier_destroy($gbarrier gbarrier);
42
43int $get_nprocs($gbarrier gbarrier);
44
45/* Creates a new local barrier object and returns a handle to it.
46 * The new barrier will be affiliated with the specified global
47 * barrier. This local barrier handle will be used as an
48 * argument in most barrier functions. The place must be in
49 * [0,size-1] and specifies the place in the global barrier
50 * that will be occupied by the local barrier.
51 * Only one call to $barrier_create may occur for each barrier-place pair.
52 * The new object will be allocated in the given scope. */
53/*@ depends_on \nothing;
54 @ assigns gbarrier;
55 @ reads gbarrier;
56 @ */
57$atomic_f $barrier $barrier_create($scope scope, $gbarrier gbarrier, int place);
58
59/* Destroys the barrier. */
60/*@ depends_on \access(barrier);
61 @ assigns barrier;
62 @ reads \nothing;
63 @ */
64$atomic_f void $barrier_destroy($barrier barrier);
65
66/* Calls the barrier associated with this local barrier object.*/
67void $barrier_call($barrier barrier);
68
69/* Calls the barrier from within an atomic section: this will yield
70 at the point where process is waiting to exit barrier. Great
71 POR performance is not guaranteed --- it is better to rewrite your
72 code so that barriers are called outside of atomic sections. */
73void $barrier_call_yield($barrier barrier);
74
75void $barrier_call_subset($barrier barrier, int nprocs);
76
77void $barrier_call_execute($barrier barrier, void foo(void));
78
79#endif
80
81
Note: See TracBrowser for help on using the repository browser.