Sun Jan 12 11:08:58 CET 2020
I'm almost immediately running into the case where I need to select on
a read and a write.
csp_send() only works when there is a reader already blocking, so to
implement buffered channels, the only way is to use csp_send() to send
an "interrupt" to a task that reads the buffer and sends it out.
However, it might be possible that the send blocks, but that a new
interrupt arrives. This means I need to select on both send and
receive, and it seems that this is also what CSP can do.
This messes up the data structure again, because a task can now be
blocked both on send and receive.
Also, select is over ops, e.g. receive channel 3, send channel 2.
What needs to change?
- Go back to only a single list. That should be straightforward.
- Every operation is implicitly a select. Same as in CSP btw!
- A task will need to refer to a list of channel operations. Those do
not need to be part of the process struct, but will have to be
stored in the process state.
- The is_rendezvous will become more complex, because all combinations
will need to be checked.
- One way to quickly do this is to split send and receive operations
in the select.