lock

suspend fun lock(offset: Long = 0, length: Long = Long.MAX_VALUE, exclusive: Boolean = true, failImmediately: Boolean = true)

Acquires an exclusive or shared byte-range lock on the file (SMB2 LOCK).

Parameters

offset

Starting byte offset of the lock range.

length

Number of bytes to lock.

exclusive

true for an exclusive lock (SMB2_LOCKFLAG_EXCLUSIVE_LOCK), or false for a shared lock (SMB2_LOCKFLAG_SHARED_LOCK).

failImmediately

If true, fails immediately (SMB2_LOCKFLAG_FAIL_IMMEDIATELY) when the range conflicts with an existing lock instead of waiting.