From reading about implementations of fwrite and fflush, it seems that they are both more likely than not already using locks to make the operations atomic. For weird platforms that do not use locks, I believe fflush would be unsafe to call from different threads.