C-events, yet another event loop, simpler, smaller, faster, safer
zelang-dev.github.io
zelang-dev.github.io
I guess because it's not possible to abstract away as much.
Aside: the wepoll mentioned in this repo is a standalone project extracted libuv, for projects that only desire to support Berkeley sockets and don’t care about other events sources (processes or pipes)
"do a read and wait for it" is synchronous I/O.
> c-events provides function wrappers to some Linux like functionality, exp. mkfifo for Windows.
void *rwtask(param_t v) {
...
a = v->int_ptr;
...
free(a);
It seems architecturally unwise to have a callback responsible for freeing its parameters. At the very least this fossilizes dependency on the stdlib heap.As for using the stdlib heap rather than some other thing: sure. But the routine allocating the buffer in this case used malloc to allocate it, and therefore freeing it with free seems at least not the worst option. If you want to do some other thing, you should do that instead.
Though I would prefer to have something not based on coroutines.