libccco

Synopsis

Files

manual (ps)
manual (pdf)
manual (txt)
releases
git tree

Examples

#include <ccco.h>
#include <stdio.h>

static void
sender(void *arg)
{
	Chan *reply;

	procsetname("sender");
	printf("hello, I'm sender\n");
	reply = arg;
	chansend(reply, &(int){0});
}

int
main(int argc, char **argv)
{
	Proc proc;
	Chan reply;
	int n;

	if(chanopen(&reply, 0, sizeof(int)) != 0)
		return 1;
	if(procinit(&proc, sender, &reply, 0) != 0)
		return 1;
	while(chanrecv(&reply, &n) == -1);
	printf("received %d\n", n);
	prockill(&proc);
	chanclose(&reply);
	return 0;
}