Asynchronous channel usage
Normal channels can't be used asynchronously, i.e. both sides must not send at the same time. They do a handshake which will fail with ET_ILLEGAL_RESOURCE if you try.
Streaming channels don't do this, so they can be used in this way. But when using streaming channels it's your responsibility to keep track of the data sizes sent through the channel.
Code: Select all
#include <stdio.h>
int main(void) {
chan c; // <= will fail
// streaming chan c; // <= works
int a, b, i, j;
a = 1;
b = 2;
par
{
{
c <: a;
c :> i;
}
{
c <: b;
c :> j;
}
}
printf("%d %d\n", i, j);
return 0;
}