> > If fwrite (ptr, size, 1, f) is atomic > > Is it?
If f is _IONBF then yes. > > and > > the sh operator >> use the system call dup(int) then > > the sh operator >> is atomic. > > ">>" will use a lot more functions that can be pre-empted than just > those two. A lot more. The simplest way to implement the sh redirectors > and >> is: open dest, fork, close 1, dup dest, close dest, execv. > If you want to guarantee what passes for atomicity, you're going to > either have to roll your own, or change what you're trying to do such > that it doesn't require it. My doubt is: Every shell, including cmd.exe, does it this way?
