Share via


Overview | Methods | This Package | All Packages

OverviewMethodsThis PackageAll Packages

File.lock

Locks a region in this file.

Syntax

public void lock( long position**, long** length )

Parameters

position

The starting position of the range to be locked.

length

The length of the range to be locked.

Exceptions

WinIOException thrown if an error occurs or if the file has been closed.

Remarks

Locking a region in a file gives the locking process exclusive access to the specified region. File locks are not inherited by processes created by the locking process. Locking a region in a file denies all other processes both read and write access to the specified region. Locking a region that goes beyond the current end-of-file position is not an error. Locks cannot overlap an existing locked region in the file.

See Also   unlock