Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/flockfile.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/flockfile.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/flockfile.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/flockfile.html on line 8

flockfile()

Acquire ownership of a file

Synopsis:

#include <stdio.h>

void flockfile( FILE* file );

Arguments:

file
A pointer to the FILE object for the file you want to lock.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The flockfile() function provides for explicit application-level locking of stdio (FILE) objects. This function 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 is used by a thread to acquire ownership of a FILE.

The implementation acts as if there is a lock count associated with each FILE. This count is implicitly initialized to zero when the FILE is created. The FILE object is unlocked when the count is zero. When the count is positive, a single thread owns the FILE. When the flockfile() function is called, if the count is zero or if the count is positive and the caller owns the FILE, the count is incremented. Otherwise, the calling thread is suspended, waiting for the count to return to zero.

Classification:

POSIX 1003.1 TSF

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

getc_unlocked(), getchar_unlocked(), putc_unlocked(), putchar_unlocked()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/f/flockfile.html on line 124

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/f/flockfile.html on line 124