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

◆ TryTakeWithNoTimeValidation()

bool System.Collections.Concurrent.BlockingCollection< T >.TryTakeWithNoTimeValidation ( [MaybeNullWhen(false)] out T item,
int millisecondsTimeout,
CancellationToken cancellationToken,
CancellationTokenSource combinedTokenSource )
inlineprivate

Definition at line 303 of file BlockingCollection.cs.

304 {
306 item = default(T);
307 cancellationToken.ThrowIfCancellationRequested();
308 if (IsCompleted)
309 {
310 return false;
311 }
312 bool flag = false;
314 try
315 {
316 flag = _occupiedNodes.Wait(0);
317 if (!flag && millisecondsTimeout != 0)
318 {
319 if (cancellationTokenSource == null)
320 {
322 }
324 }
325 }
326 catch (OperationCanceledException)
327 {
328 cancellationToken.ThrowIfCancellationRequested();
329 return false;
330 }
331 finally
332 {
333 if (cancellationTokenSource != null && combinedTokenSource == null)
334 {
335 cancellationTokenSource.Dispose();
336 }
337 }
338 if (flag)
339 {
340 bool flag2 = false;
341 bool flag3 = true;
342 try
343 {
344 cancellationToken.ThrowIfCancellationRequested();
345 flag2 = _collection.TryTake(out item);
346 flag3 = false;
347 if (!flag2)
348 {
350 }
351 }
352 finally
353 {
354 if (flag2)
355 {
356 if (_freeNodes != null)
357 {
359 }
360 }
361 else if (flag3)
362 {
364 }
365 if (IsCompleted)
366 {
368 }
369 }
370 }
371 return flag;
372 }
static string BlockingCollection_Take_CollectionModified
Definition SR.cs:40
Definition SR.cs:7
static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token1, CancellationToken token2)

References System.Collections.Concurrent.BlockingCollection< T >._collection, System.Collections.Concurrent.BlockingCollection< T >._consumersCancellationTokenSource, System.Collections.Concurrent.BlockingCollection< T >._freeNodes, System.Collections.Concurrent.BlockingCollection< T >._occupiedNodes, System.SR.BlockingCollection_Take_CollectionModified, System.cancellationToken, System.Collections.Concurrent.BlockingCollection< T >.CancelWaitingConsumers(), System.Collections.Concurrent.BlockingCollection< T >.CheckDisposed(), System.Threading.CancellationTokenSource.CreateLinkedTokenSource(), System.Collections.Concurrent.BlockingCollection< T >.IsCompleted, System.item, System.millisecondsTimeout, System.Threading.SemaphoreSlim.Release(), System.Threading.CancellationTokenSource.Token, and System.Threading.SemaphoreSlim.Wait().

Referenced by System.Collections.Concurrent.BlockingCollection< T >.GetConsumingEnumerable(), System.Collections.Concurrent.BlockingCollection< T >.TryTake(), System.Collections.Concurrent.BlockingCollection< T >.TryTake(), and System.Collections.Concurrent.BlockingCollection< T >.TryTake().