.... (periods), download progress indicator, 779
AggregateException.Flatten()
method, 780
AggregateException.Handle()
method, 764, 780
Anonymous functions, guidelines, 533
Antecedent tasks, 757
AspNetSynchronizationContext
, 794
async
keyword
purpose of, 786
task-based asynchronous pattern, 781–786, 795–798
Asynchronous
high-latency operations with the TPL, 777–781
tasks. See Multithreading, asynchronous tasks.
AttachedToParent
enum, 758
await
keyword, task-based asynchronous pattern, 781–786, 791–792, 795–798
await
operators, task-based asynchronous pattern, 797–798
Break()
method, 808
Breaking parallel loop iterations, 808
Canceling
cooperative cancellation, 769
multithreading, PLINQ queries, 811–813
parallel loop iterations, 805–806
tasks. See Multithreading, canceling tasks.
CancellationToken
object, 769–772
CancellationTokenSource.Cancel()
method, 770–771
Capturing loop variables with lambda expressions, 531–533
Chaining tasks, 757
Composing large tasks from smaller one, 756–758
Continuation tasks, 757
ContinueWith()
method, 756–758, 760–761, 764–765, 779
Control flow
misconceptions, 784
multithreading asynchronous tasks, 755
Cooperative cancellation, definition, 769
CountdownEvent
, 840
Custom asynchronous methods, 787–791
DenyChildAttach
enum, 758
DispatcherSynchronizationContext
, 794
Disposable tasks, 774
Exception handling
parallel loop iterations, 803–804
task-based asynchronous pattern, 779–780
Exceptions
catching, 439
Exceptions, catching, 439
Exceptions, unhandled
handling with AggregateException
, 762–765
multithreading guidelines, 768
ExecuteSynchronously
enum, 759
GetResponseAsync()
method, 779
HideScheduler
enum, 759
IDisposable
, 774
IsCancellationRequested
property,
monitoring, 770–771
Lambda expressions, capturing loop variables, 531–533
Lambdas, asynchronous, 786–787
Latency, synchronous high-latency operations, 775–777
LazyCancellation
enum, 759
LongRunning
enum, 758
Loop variables, capturing with lambda expressions, 531–533
MaxDegreeOfParallelism
property, 807
Multithreading, asynchronous tasks
AggregateException.Handle()
method, 764
antecedent tasks, 757
asynchronous continuations, 756–762
chaining tasks, 757
composing large tasks from smaller one, 756–758
continuation tasks, 757
ContinueWith()
method, 756–758, 760–761, 764–765
control flow, 755
observing unhandled exceptions, 764–765
registering for notification of task behavior, 760–761
registering for unhandled exceptions, 766–768
TaskContinuationOptions
enums, 758–759
unhandled exception handling with AggregateException
, 762–765
unhandled exceptions on a thread, 765–768
UnhandledException
event, 766
Multithreading, canceling tasks
CancellationToken
object, 769–772
CancellationTokenSource.Cancel()
method, 770–771
cooperative cancellation, definition, 769
disposable tasks, 774
IDisposable
, 774
IsCancellationRequested
property,
monitoring, 770–771
TaskCreationOptions.LongRunning
option, 773–774
Task.Factory.StartNew()
method, 772–773
WaitHandle
, 774
Multithreading, guidelines
parallel loops, 801
unhandled exceptions, 768
Multithreading, parallel loop iterations
Break()
method, 808
breaking, 808
exception handling with AggregateException
, 803–804
MaxDegreeOfParallelism
property, 807
Parallel.For()
loops, 807
Parallel.For()
method, 808
Parallel.ForEach()
loops, 807
Parallel.ForEach()
method, 808
ParallelOptions
parameter, 807
Stop()
method, 808
TPL performance tuning, 802–803
Multithreading, PLINQ queries
Multithreading, task-based asynchronous pattern
AggregateException.Flatten()
method, 780
AggregateException.Handle()
method, 780
AspNetSynchronizationContext
, 794
async
and await
with the Windows UI, 795–798
async
keyword, purpose of, 786
asynchronous high-latency operations with the TPL, 777–781
awaiting non-Task<T>
values, 791–792
ContinueWith()
method, 779
control flow misconceptions, 784
control flow within tasks, 784–786
custom asynchronous methods, 787–791
DispatcherSynchronizationContext
, 794
GetResponseAsync()
method, 779
Process.Kill()
method, 789
ReadToEndAsync()
method, 779
RunProcessAsync()
method, 788–789
synchronization context, 793–795
synchronous high-latency operations, 775–777
task drawbacks, overview, 775
TaskCompletionSource.SetResult()
method, 789
TaskCompletionSource<T>
object, 788–789
Unwrap()
method, 779
WriteWebRequestSizeAsync()
method, 780, 783
.NET versions, 29
NotOnCanceled
enum, 759
NotOnFaulted
enum, 758
NotOnRanToCompletion
enum, 758
OnlyOnCanceled
enum, 758
OnlyOnFaulted
enum, 759
OnlyOnRanToCompletion
enum, 759
Parallel loop iterations. See Multithreading, parallel loop iterations.
Parallel.For()
loops, 807
Parallel.For()
method, 808
Parallel.ForEach()
loops, 807
Parallel.ForEach()
method, 808
ParallelOptions
parameter, 807
PreferFairness
enum, 758
Process.Kill()
method, 789
ReadToEndAsync()
method, 779
Registering for
notification of task behavior, 760–761
RunContinuationAsynchronously
enum, 759
RunProcessAsync()
method, 788–789
SemaphoreSlim
, 840
SemaphoreSlim.WaitAsync()
method, 840
Stop()
method, 808
Synchronization context, task-based asynchronous pattern, 793–795
Synchronous high-latency operations, 775–777
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Catch()
method, 439
System.Threading.Timer
, 846
System.Timers.Timer
, 846
System.Windows.Forms.Timer
, 846
System.Windows.Threading.DispatcherTimer
, 846
TAP (Task-based Asynchronous Pattern), problems addressed by, 799
Task-based asynchronous pattern. See Multithreading, task-based asynchronous pattern.
TaskCompletionSource.SetResult()
method, 789
TaskCompletionSource<T>
object, 788–789
TaskContinuationOptions
enums, 758–759
TaskCreationOptions.LongRunning
option, 773–774
Task.Factory.StartNew()
method, 772–773
Tasks
antecedent, 757
asynchronous. See Multithreading, asynchronous tasks.
canceling. See Multithreading, canceling tasks.
chaining, 757
composing large from smaller, 756–758
disposable, 774
drawbacks, 775
Task<T>,
awaiting non-Task<T>
values, 791–792
Thread synchronization, synchronization types
CountdownEvent
, 840
SemaphoreSlim
, 840
SemaphoreSlim.WaitAsync()
method, 840
Thread synchronization, Task
return with no await
operator, 820–821
Thread synchronization, timers
System.Threading.Timer
, 846
System.Timers.Timer
, 846
System.Windows.Forms.Timer
, 846
System.Windows.Threading.DispatcherTimer
, 846
Throwing exceptions
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
method, 439–440
without replacing stack information, 439
Timers. See Thread synchronization, timers.
TPL (Task Parallel Library)
synchronous high-latency operations, 777–781
Unhandled exceptions
handling with AggregateException
, 762–765
multithreading guidelines, 768
UnhandledException
event, 766
Unwrap()
method, 779
WaitHandle
, 774