source: CIVL/examples/concurrency/mp_proc.cvh@ d01ddb3

1.23 2.0 main test-branch
Last change on this file since d01ddb3 was 08f1543, checked in by Ziqing Luo <ziqing@…>, 11 years ago

fixed prolems in ring examples. Add bad ring examples. Add a if-condition for checking potential deadlock in libcommenabler

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

  • Property mode set to 100644
File size: 908 bytes
Line 
1 void send(void *buf, int count, int dest, int tag, $comm comm) {
2 $message out = $message_pack(rank, dest, tag, buf, count*sizeof(double));
3 $comm_enqueue(comm, out);
4 }
5
6 void recv(void *buf, int count, int source, int tag, $comm comm) {
7 $message in = $comm_dequeue(comm, source, tag);
8 $message_unpack(in, buf, count*sizeof(double));
9 }
10
11 void sendrecv(void *sendbuf, int sendcount, int dest, int sendtag,
12 void *recvbuf, int recvcount, int source, int recvtag, $comm comm) {
13 $message out = $message_pack(rank, dest, sendtag, sendbuf, sendcount*sizeof(double));
14 $message in;
15
16 $choose {
17 $when (1){
18 $comm_enqueue(comm, out);
19 in = $comm_dequeue(comm, source, recvtag);
20 }
21 $when (1){
22 in = $comm_dequeue(comm, source, recvtag);
23 $comm_enqueue(comm, out);
24 }
25 }
26 $message_unpack(in, recvbuf, recvcount*sizeof(double));
27 }
28
29 $when (__start);
Note: See TracBrowser for help on using the repository browser.