3 ms·
If “write” expects you to always call it in a loop, I wonder why it wasn’t simply implemented so that it calls itself in a loop in the first place. Or at least
by brianberns 8y ago
If “write” expects you to always call it in a loop, I wonder why it wasn’t simply implemented so that it calls itself in a loop in the first place. Or at least provide a “writeAll” wrapper function.
- lemoncucumber 8y agoWhat if the disk is literally unplugged after a partial write? (or the network cable unplugged, etc.) Callers would still need to be informed that a partial write occurred and would need to do something about it.
- DannyBee 8y agoThis is literally the case study from worse is better :) https://www.jwz.org/doc/worse-is-better.html https://www.jwz.org/doc/worse-is-better.html
- adrianratnapala 8y agoWhen I call write(), it is typically already inside a bigger loop. If the system can't write my whole buffer right now, then I am happy to get the CPU back so I can do more work before trying again (and now I might have more data for it too).