Sign in Join
FPDoc Onlineexperiment

fpFlock function

In unit Unix

Lock a file (advisory lock).

Declaration

pascal
function fpFlock(var T: text; mode: cint): cint

Description

FpFLock implements file locking. it sets or removes a lock on the file F. F can be of type Text or File, or it can be a Linux file descriptor (a longint) Mode can be one of the following constants :

LOCK_SH
sets a shared lock.
LOCK_EX
sets an exclusive lock.
LOCK_UN
unlocks the file.
LOCK_NB
This can be OR-ed together with the other. If this is done the application doesn't block when locking.

The function returns zero if successful, a nonzero return value indicates an error.

Errors

Extended error information is returned by the FpGetErrno function:

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.