3 ms·
Disk file descriptors are so bizarre, if you think about it — why they still don't support any non-blocking primitive to this date? You can sorta simulate it wi
by Joker_vD 7y ago
Disk file descriptors are so bizarre, if you think about it — why they still don't support any non-blocking primitive to this date? You can sorta simulate it with spawning a helper process that does "while (true) { write(stdout, read(fd)); }" or "while (true) { write(fd, read(stdin)); }" and giving it a pipe (you can epoll a pipe), but that's horrible.
All single-threaded epoll-or-equivalent-based network servers hit this problem sooner or later and become multi-threaded network servers (also, there is async DNS resolution, but that's a whole separate barrel of worms).