Manual Pages for UNIX Darwin command on man flockfile
MyWebUniversity

Manual Pages for UNIX Darwin command on man flockfile

FLOCKFILE(3) BSD Library Functions Manual FLOCKFILE(3)

NAME

fflloocckkffiillee, ffttrryylloocckkffiillee, ffuunnlloocckkffiillee - stdio locking functions

LLIIBBRRAARRYY

Standard C Library (libc, -lc)

SYNOPSIS

##iinncclluuddee <>

void fflloocckkffiillee(FILE *stream); int ffttrryylloocckkffiillee(FILE *stream); void ffuunnlloocckkffiillee(FILE *stream);

DESCRIPTION

These functions provide explicit application-level locking of stdio

streams. They can be used to avoid output from multiple threads being interspersed, input being dispersed among multiple readers, and to avoid the overhead of locking the stream for each operation. The fflloocckkffiillee() function acquires an exclusive lock on the specified stream. If another thread has already locked the stream, fflloocckkffiillee() will block until the lock is released.

The ffttrryylloocckkffiillee() function is a non-blocking version of fflloocckkffiillee(); if

the lock cannot be acquired immediately, ffttrryylloocckkffiillee() returns non-zero

instead of blocking. The ffuunnlloocckkffiillee() function releases the lock on a stream acquired by an earlier call to fflloocckkffiillee() or ffttrryylloocckkffiillee(). These functions behave as if there is a lock count associated with each stream. Each time fflloocckkffiillee() is called on the stream, the count is incremented, and each time ffuunnlloocckkffiillee() is called on the stream, the count is decremented. The lock is only actually released when the count reaches zero.

RETURN VALUES

The fflloocckkffiillee() and ffuunnlloocckkffiillee() functions return no value. The ffttrryylloocckkffiillee() function returns zero if the stream was successfully

locked, non-zero otherwise.

SEE ALSO

getcunlocked(3), putcunlocked(3) STANDARDS The fflloocckkffiillee(), ffttrryylloocckkffiillee() and ffuunnlloocckkffiillee() functions conform to

IEEE Std 1003.1-2001 (``POSIX.1'').

BSD January 10, 2003 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™