VMS Help
CRTL, flockfile
*Conan The Librarian
|
Locks a stdio stream.
This function is supported on OpenVMS Integrity servers and
Alpha only.
Format
#include <stdio.h>
void flockfile (FILE *file_ptr);
file_ptr
A file pointer.
The flockfile function locks a stdio stream so that a thread can
have exclusive use of that stream for multiple I/O operations.
Use the flockfile function for a thread that wants to ensure
that the output of several printf functions, for example, is not
garbled by another thread also trying to use printf.
File pointers passed are assumed to be valid; flockfile will
perform locking even on invalid file pointers. Also, the
funlockfile function will not fail if the calling thread does
not own a lock on the file pointer passed.
Matching flockfile and funlockfile calls can be nested. If the
stream has been locked recursively, it will remain locked until
the last matching funlockfile is called.
All C RTL file-pointer I/O functions lock their file pointers as
if calling flockfile and funlockfile.
See also ftrylockfile and funlockfile.