*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> ftrylockfilefunlockfile (3)              
Title
Content
Arch
Section
 

flockfile(3)

Contents


NAME    [Toc]    [Back]

       flockfile,  ftrylockfilefunlockfile, stdio - locking functions

SYNOPSIS    [Toc]    [Back]

       #include <stdio.h>

       void flockfile(
               FILE * file ); int ftrylockfile
               FILE * file ); void funlockfile
               FILE * file );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces documented on this reference  page  conform  to
       industry standards as follows:

       flockfile, funlockfile: POSIX.1c, XSH5.0

       ftrylockfile: XSH5.0

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies the stream to be locked.

DESCRIPTION    [Toc]    [Back]

       The flockfile(), ftrylockfile, and  funlockfile  functions
       provide  for  explicit  application-level locking of stdio
       (FILE*) objects. These functions can be used by  a  thread
       to  delineate  a sequence of I/O statements that are to be
       executed as a unit.

       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  wishes to ensure that the output of several printf()
       functions, for example, is not garbled by  another  thread
       also trying to use printf().

       The ftrylockfile() function is used by a thread to acquire
       ownership of a stdio  (FILE*)  object  if  the  object  is
       available.  The  ftrylockfile() function is a non-blocking
       version of flockfile().

       The funlockfile() function unlocks a stdio stream, causing
       the  thread  that  had been holding the lock to relinquish
       exclusive use of the stream.

       The behavior of the flockfile()  and  funlockfile()  functions
  is unspecified if the file parameter does not point
       to a valid FILE structure. The behavior  of  funlockfile()
       is  also  unspecified  if  a thread other than the current
       owner calls funlockfile().

       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.

RETURN VALUE    [Toc]    [Back]

       None  for  flockfile()  and  funlockfile().  The ftrylockfile()
 function returns zero for success and  non-zero  to
       indicate that the lock cannot be acquired.

SEE ALSO    [Toc]    [Back]

      
      
       Functions: getc_unlocked(3), putc_unlocked(3)



                                                     flockfile(3)
[ Back ]
 Similar pages
Name OS Title
ftrylockfile FreeBSD stdio locking functions
flockfile FreeBSD stdio locking functions
funlockfile FreeBSD stdio locking functions
lockf IRIX record locking on files
lockf OpenBSD record locking on files
rpc.lockd OpenBSD NFS file locking daemon
vm_map_lock_read FreeBSD vm_map locking macros
lockf NetBSD record locking on files
VOP_ADVLOCK FreeBSD advisory record locking
rpc.lockd FreeBSD NFS file locking daemon
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service