3 ms·
It's usually printf() -> fwrite() -> write() -> syscall. You need the fwrite (or something equivalent) in there for buffering and concurrency, otherwise multith
by kstenerud 6y ago
It's usually printf() -> fwrite() -> write() -> syscall. You need the fwrite (or something equivalent) in there for buffering and concurrency, otherwise multithreaded printfs would stomp on each other.
- saagarjha 6y agoUsually you go through vfprintf, which is the “most generic” function, and that will grab the file’s lock.