Skip to content
API referenceDevelopmentEngine APIEngine ccf7d03f
Synced
  • Waits for exclusive ownership without blocking an owner thread or changing shared data.

API: engine
Project: Inno.Core.IO

public static System.Threading.Tasks.ValueTask<Inno.Core.IO.FileLease> Inno.Core.IO.FileLease.AcquireAsync(string path, System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))

Parameter path: The absolute lease file path; all participants must use the same persistent path.

Parameter timeout: The maximum wait, or F:System.Threading.Timeout.InfiniteTimeSpan for no time limit.

Parameter cancellationToken: Cancels waiting before ownership is returned.

The exclusive lease whose disposal permits the next participant to acquire ownership.

Lease files remain after disposal. Removing them would let Unix processes lock different inodes for the same path while an earlier participant still owns the original inode.

Exception T:System.ArgumentException: The path is empty or relative, or the timeout is negative and not infinite.

Exception T:System.TimeoutException: Another participant retains ownership beyond the permitted wait.

Exception T:System.OperationCanceledException: Waiting was canceled; no lease is returned.

Exception T:System.IO.IOException: The lease cannot be opened for a reason other than competing ownership.

Exception T:System.UnauthorizedAccessException: The operating system denies access to the lease path.