File.tryLock

bool tryLock(LockType lockType = LockType.readWrite, ulong start = 0, ulong length = 0)

Attempts to lock the specified file segment. If both start and length are zero, the entire file is locked.

Returns

true if the lock was successful, and false if the

specified file segment was already locked.