Your question is a bit ambiguous, so I will try to answer a few interpretations.
If your question is how soon after fclose it is possible to return to the fopen file again, the answer will be simple that it is possible at any time, even before fclose . POSIX does not allow opening a file to be mutually exclusive; it can open the file as many times as you like if you do not fall within the limits of open system files. Even if you are on an inappropriate platform, such as Windows, with the implementation of pseudo-POSIX threads while fopen ordered after fclose , you are fine, because the basic close operation must complete before fclose can return.
If your concern is the availability of data written by one thread for reading by another thread, then as long as you can establish a “between events” connection before the flash (either explicitly via fflush or as part of the fclose operation) that wrote data and reads into elsewhere, everything is fine. Any pthread synchronization functions, such as using a mutex or pthread_join , would be sufficient to establish this relationship.
source share