source: CIVL/examples/concurrency/simpleSendFunction.cvl

main
Last change on this file 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: 751 bytes
Line 
1#include <stdio.h>
2#include <comm.cvh>
3
4void testStream($gcomm gc){
5 $comm comm = $comm_create($here, gc, 1);
6 $message message = $comm_dequeue(comm, 0, $COMM_ANY_TAG);
7 printf("New kernel message received\n");
8 void (*kernel)();
9 $message_unpack(message, (void*)&kernel, sizeof(kernel));
10 kernel();
11 $comm_destroy(comm);
12}
13
14void print(){
15 printf("Inside kernel function!\n");
16}
17
18void main(){
19 $gcomm gcomm = $gcomm_create($here, 2);
20 $comm comm = $comm_create($here, gcomm, 0);
21 $proc otherProc = $spawn testStream(gcomm);
22 void (*printFunc)() = &print;
23 $message message = $message_pack(0, 1, 0, &printFunc, sizeof(printFunc));
24 $comm_enqueue(comm, message);
25 $wait(otherProc);
26 $comm_destroy(comm);
27 $gcomm_destroy(gcomm, NULL);
28}
Note: See TracBrowser for help on using the repository browser.