Method TryAcquire
TryAcquire(string, TimeSpan, out IDisposable)
Acquires the materialization lock for one destination file if it
lands within timeout; returns false, with no
waiter left behind, when another process still holds it at the
deadline. For a caller that must answer rather than wait out a
transfer (a delete, a probe): it never sits through a multi-hour
pull, and it leaves nothing polling the volume once it has given
up. Dispose handle after the write attempt.
public static bool TryAcquire(string destinationPath, TimeSpan timeout, out IDisposable handle)
Parameters
destinationPathstringThe model file's final local path.
timeoutTimeSpanHow long to keep trying before giving up.
handleIDisposableThe lock to dispose when the attempt is over; null when the lock was not acquired.