funlockfile man page on BSDi

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDi logo
[printable version]

FLOCKFILE(3)		    BSD Programmer's Manual		  FLOCKFILE(3)

NAME
     flockfile, ftrylockfile, funlockfile - synchronize stdio calls from mul-
     tiple threads.

SYNOPSIS
     #include <pthread.h>
     #include <stdio.h>

     void
     flockfile(FILE *stream);

     int
     ftrylockfile(FILE *stream);

     void
     funlockfile(FILE *stream);

DESCRIPTION
     This interface is defined by IEEE Std1003.1c (``POSIX''). The
     flockfile(), ftrylockfile(), and funlockfile() functions provide a mecha-
     nism to synchronize access to a stdio stream across multiple threads.
     These functions may be used by a thread to delineate a sequence of stdio
     calls that should be executed as a unit.

     The flockfile() function is used by a thread to guarantee exclusive own-
     ership of a stdio stream.	The calling thread will block until the lock
     can be completed.

     The ftrylockfile() function is a non-blocking version of flockfile().

     The flockfile() and ftrylockfile() calls are associated with a lock count
     and a thread holding the lock may call flockfile multiple times without
     concern for deadlock.  The stdio stream is unlocked when a corresponding
     number of calls to funlockfile() are completed.

     The funlockfile() function releases a previously held lock or if
     flockfile() has been called multiple times decreases the lock count for
     the current thread.  When the lock count decreases to zero the stream is
     unlocked.	When funlockfile() causes a lock on a stdio stream to be re-
     leased at most one thread waiting for the lock will proceed.

RETURN VALUES
     The flockfile() and funlockfile() functions return no value.

     The ftrylockfile() function returns 0 if a lock was successfully ac-
     quired, and non-zero otherwise.

SEE ALSO
     pthreads(3),  getc_unlocked(3),  getchar_unlocked(3),  putc_unlocked(3),
     putchar_unlocked(3)

STANDARDS
     The flockfile, ftrylockfile, and funlockfile functions conform to IEEE
     Std1003.1c (``POSIX'').

HISTORY
     The flockfile, ftrylockfile, and funlockfile functions first appeared in
     BSD/OS 3.0.

BSDI BSD/OS			 June 3, 1996				     1
[top]

List of man pages available for BSDi

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net