Zig's Io.Threaded is Neat
29 points by nickmonad
29 points by nickmonad
Isn't pretending that all syscalls can be canceled a lie? Not all syscalls guarantee that they are interruptible (naively, a user might expect that any long-running syscall may be promptly interrupted). https://stackoverflow.com/questions/14542987/why-doing-i-o-in-linux-is-uninterruptible
Retrying is also not necessarily safe for all syscalls after interruption.
If connect() fails, consider the state of the socket as unspecified. Portable applications should close the socket and create a new one for reconnecting.
https://man7.org/linux/man-pages/man2/connect.2.html
Also, I'm not sure if it'll work OOTB with existing debuggers. Usually debuggers want to be aware of signals/they'll catch them. But you probably don't want your program stopping at every cancelation.
While being traced, the tracee will stop each time a signal is delivered, even if the signal is being ignored.
Zig's std.Io interface is a cross platform abstraction; it doesn't necessarily map one-to-one with syscalls.
Could you argue that POSIX enforces some idea of general idea of how syscalls would go, through? I understand this is much of a muchness seeing it’s not adhered by the letter from what I can see…