Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ WaitUntilCountOrTimeoutAsync()

async Task< bool > System.Threading.SemaphoreSlim.WaitUntilCountOrTimeoutAsync ( TaskNode asyncWaiter,
int millisecondsTimeout,
CancellationToken cancellationToken )
inlineprivate

Definition at line 371 of file SemaphoreSlim.cs.

372 {
373 await new ConfiguredNoThrowAwaiter<bool>(asyncWaiter.WaitAsync(TimeSpan.FromMilliseconds(millisecondsTimeout), cancellationToken));
374 if (cancellationToken.IsCancellationRequested)
375 {
377 }
378 if (asyncWaiter.IsCompleted)
379 {
380 return true;
381 }
383 {
384 if (RemoveAsyncWaiter(asyncWaiter))
385 {
386 cancellationToken.ThrowIfCancellationRequested();
387 return false;
388 }
389 }
390 return await asyncWaiter.ConfigureAwait(continueOnCapturedContext: false);
391 }
bool RemoveAsyncWaiter(TaskNode task)
readonly StrongBox< bool > m_lockObjAndDisposed

References System.cancellationToken, System.Threading.Tasks.Task< TResult >.ConfigureAwait(), System.Threading.Tasks.TaskScheduler.Default, System.TimeSpan.FromMilliseconds(), System.Threading.Tasks.Task< TResult >.IsCompleted, System.Threading.SemaphoreSlim.m_lockObjAndDisposed, System.millisecondsTimeout, System.Threading.SemaphoreSlim.RemoveAsyncWaiter(), and System.Threading.Tasks.Task< TResult >.WaitAsync().

Referenced by System.Threading.SemaphoreSlim.WaitAsync().