Tasks are required to be awaited or cancelled, so yes.
std.Io doesn’t implement ‘structured concurrency’ but you can certainly mimic its style. I expect most use cases will. std.Io is ‘structured concurrency’ assuming it is used soundly.
You can certainly implement, and i expect std will eventually, an ArenaIo that could enforce this, or clean up, both can be provided.
sorry for intervening. event-driven-state-machines (if you implement them properly)
have “structured concurrency” just by theirs’ nature.
Actually I do not know what approach to achieve concurrency is “better”, coroutines or edsm… well, just a question - can a coroutine pass some arbitrary data to any coroutine at any moment?
I mean, for example, this:
int mep2_init_M1(struct edsm *src, struct edsm *me, void *dptr)
{
struct upsdaq *ud = me->data;
struct upsd_client *udc = &ud->udc;
udc->conn_sm = src; // store a pointer to connector machine
....
Here I used only the pointer to a machine which sent M1 message,
but that machine could also had been passed some additional data via dptr.
You can construct your program as a (sometimes very cool ) team of edsms,
can you do that with coroutines?