DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

flockfile(S)


flockfile -- grant thread ownership of a file

Syntax

cc . . . -lc

#include <stdio.h>

void flockfile(FILE *file);

Description

This function provide for explicit application-level locking of standard I/O objects. It can be used by a thread to begin a sequence of I/O statements that are to be executed as a unit.

flockfile gives the calling thread ownership of file if file is not currently owned by another thread. A thread keeps ownership of the file until it calls funlockfile.

A thread that tries to get ownership of a file that is currently owned by another thread is suspended until the current owner relinquishes the file.

A thread can do multiple calls to flockfile and ftrylockfile and not get suspended if it currently owns the file, but an equal number of funlockfile calls are necessary to relinquish the object completely.

See also

flock(S), ftrylockfile(S), funlockfile(S),
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003