3using System.Threading.Tasks;
22 throw new ArgumentNullException(nameof(action));
23 if (Interlocked.CompareExchange(ref
this.gate, 1, 0) != 0)
29 await action().ConfigureAwait(
false);
34 Interlocked.Exchange(ref this.gate, 0);
41 public bool IsBusy => this.gate != 0;
Simple asynchronous reentrancy guard that ensures a critical async section is not executed concurrent...
async Task< bool > RunIfNotBusy(Func< Task > action)
Attempts to execute the asynchronous action if no prior execution is in progress. Returns false if th...
bool IsBusy
Returns true if an execution is currently in progress.