[<<][sm][>>][..]
Thu Jan 16 20:34:19 CET 2020

SELECT macro

Something like this:

        switch(SELECT(b,
                      {EVT(b->c_data, b->token),
                       EVT(...)},
                      {EVT(b->c_int,  b->nb_bytes)}))

First clause is send, second is receive.

This doesn't work well with macros.
Maybe use a begin/end construct?

SELECT_SEND(s,2)
  EVT(s, 0, chan1, var1)
  EVT(s, 1, chan2, var2)
SELECT_RECV(s,1)
  EVT(s, 2, chan3, var3)
SELECT_END {
case 0: ...
case 1: ...
case 2: ...
}

These seem possible, but awkward.  Maybe just stick to raw?

Quirky idomatic, but quite clear actually.

        CSP_EVT(b, 0, b->c_data, b->token);     /* SND */
        CSP_EVT(b, 1, b->c_int,  b->nb_bytes);  /* RCV */
        CSP_SEL(b, 1/*nb_send*/, 1/*nb_recv*/);

I can' figure out how to turn it into an abstraction, so use
switch(task->selected) {}.




[Reply][About]
[<<][sm][>>][..]