3 ms·
> For a lot of the interruptible system calls, one has to write defensive code. Errrr, duh. Remove "interruptible" and that sentence still holds very true. If
by jstimpfle 7y ago
> For a lot of the interruptible system calls, one has to write defensive code.
Errrr, duh. Remove "interruptible" and that sentence still holds very true.
If you don't care about being interruptible, write restarting wrappers doing a simple subtraction. (Or use fread(3)/fwrite(3)). It's not hard.
nanosleep(2) gives you back the remaining time, it's about as easy to use as read(2)/write(2). Very simple. sleep(3) doesn't, but due to seconds resolution it's not a generally useful API anyway. Still useful for quick debugging. Not a system call, but a libc call, by the way.
- mcculley 7y agoI think we are in complete agreement that it is not hard to write defensive wrappers to work around the fact that the API is a mess.