1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include <civlc.h>
|
|---|
| 2 |
|
|---|
| 3 | void worker(int value) {
|
|---|
| 4 | for (int i = 0; i < value; i++) {
|
|---|
| 5 | ; // Do work
|
|---|
| 6 | }
|
|---|
| 7 | }
|
|---|
| 8 |
|
|---|
| 9 | void main() {
|
|---|
| 10 | int nprocs = 3;
|
|---|
| 11 | $proc procs[nprocs];
|
|---|
| 12 | $comm comm;
|
|---|
| 13 | $message message;
|
|---|
| 14 | $message* message2;
|
|---|
| 15 |
|
|---|
| 16 | procs[0] = $self;
|
|---|
| 17 | procs[1] = $spawn worker(4);
|
|---|
| 18 | procs[2] = $spawn worker(5);
|
|---|
| 19 | comm = $comm_create(nprocs, procs);
|
|---|
| 20 | message = $message_pack(0, 1, 0, &nprocs, sizeof(int));
|
|---|
| 21 | $comm_enqueue(&comm, &message);
|
|---|
| 22 | message2 = $comm_dequeue(&comm, 0, 1, 0);
|
|---|
| 23 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.