All the channel-ends in CHP are instances of ReadableChannel (for ends that
you can read from) or WriteableChannel (for ends that you can write to).
The readChannel and writeChannel functions are the standard way to communicate
on a channel. These functions wait for the other party in the communication
to arrive, then exchange the data, then complete. In pseudo-code, the semantics
are like this when two parties (shown here as two columns) communicate:
do sync sync
x <- return y
done done
Further options are offered by the extReadChannel and extWriteChannel channels,
which allow either side to perform additional (so-called extended) actions during the communication.
The semantics when both sides are performing extended actions are:
do sync sync
y <- extWriteAction
x <- return y
x' <- extReadAction x done
done done
return x'
Neither end need know that the other is performing an extended action, and any
combination is possible (e.g. a normal writeChannel with an extReadChannel).
|