source: CIVL/examples/languageFeatures/comm.cvl@ 809644b

1.23 2.0 main test-branch
Last change on this file since 809644b was 7db0b13, checked in by Tim Zirkel <zirkeltk@…>, 13 years ago

Implemented $comm_dequeue.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@198 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 477 bytes
Line 
1#include <civlc.h>
2
3void worker(int value) {
4 for (int i = 0; i < value; i++) {
5 ; // Do work
6 }
7}
8
9void 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.