ftrylockfile(S-osr5)
ftrylockfile --
grant thread ownership of a file
Syntax
cc . . . -lc
#include <stdio.h>
int ftrylockfile(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.
ftrylockfile gives the calling thread ownership of file
if file is not currently owned by another thread.
This function is similar to flockfile, except that it returns
nonzero if the file is already locked.
It returns zero on success.
A thread can do multiple calls to ftrylockfile
and flockfile successfully
if it currently owns the file, but an equal number of funlockfile
calls are necessary to relinquish the object completely.
Return values
On success, ftrylockfile returns zero and locks the stream
file.
If the stream is already locked by a different
thread, it returns nonzero.
See also
flock(S-osr5),
flockfile(S-osr5),
funlockfile(S-osr5),
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005