flock: flockfile, ftrylockfile, funlockfile --
standard I/O synchronization functions
Synopsis
#include <stdio.h>
void flockfile(FILE file);
void funlockfile(FILE file);
int ftrylockfile(FILE file);
Description
These functions provide for explicit application-level
locking of standard I/O stream objects.
They are used by a thread to delineate a sequence of I/O statements
that are to be executed as a unit.
flockfile
grants thread ownership of a file, suspends thread until
ownership is granted
ftrylockfile
similar to flockfile, except that it returns
a value for success or failure
funlockfile
relinquishes file ownership granted to a thread by a previous successful
call to flockfile or ftrylockfile