Standards / Extensions | C or C++ | Dependencies |
---|---|---|
Single UNIX Specification, Version 3 |
both | z/OS V1R8 |
#define _UNIX03_SOURCE
#include <stdio.h>
void flockfile(FILE *file);
This function provides explicit application-level locking of stdio (FILE*) objects. The flockfile() family of the functions can be used by a thread to delineate a sequence of I/O statements that are executed as a unit.
The flockfile() function acquires ownership of a (FILE*) object for the thread, waiting if necessary, and increases the internal lock count. If the thread has previously been granted ownership, the internal lock count is increased.
The internal lock count allows matching calls to flockfile() (or successful calls to ftrylockfile()) and funlockfile() to be nested.
z/OS® Consideration: The flockfile() family of functions acts upon FILE * objects. It is possible to have the same physical file represented by multiple FILE * objects that are not recognized as being equivalent. For example, fopen() opens a file and open() opens the same file, and then fdopen() creates a FILE * object. In this case, locking the first FILE * does not prevent the second FILE * from also being locked and used.
None.