funlockfile

Unlocks an application-level lock of a file object.

Library:LibC
Classification:POSIX
Service:File and Directory I/O

Syntax

  #include <stdio.h> 
   
  void funlockfile (
     FILE   *fp);
  

Parameters

fp

(IN) Points to the file object to unlock.

Remarks

The funlockfile function behaves as if there is a lock count associated with each file object or stream. This count is initialized to zero when the file object is created. The file object is unlocked when the count is zero. When the count is positive, a single thread owns the file object. When one of the locking functions is called, the count is incremented on the following conditions:

  • The count is zero

  • The count is positive and the caller owns the file object. This allows matching calls to be nested.

Each call to the funlockfile function decrements the count.

All functions that reference file objects behave as if they use flockfile and funlockfile internally to obtain ownership of these file objects.

See Also