This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

<< Previous | 1 | 2 | 3 | 4 | Next >> |
Cancelling Parallel LINQ QueriesCancelling Parallel LINQ Queries
Parallel Language-Integrated Query (PLINQ) provides the performance benefits associated with parallel tasks, with the declarative approach of LINQ. This powerful combination also supports cancellation of queries, using standard cancellation tokens.
Thread Synchronisation with the Monitor ClassThread Synchronisation with the Monitor Class
The lock statement provides a simple way to block access to critical sections of code in multi-threaded and parallel software. When more flexibility is required, the members of the Monitor class can be used to achieve similar thread synchronisation.
Locking for Thread SynchronisationLocking for Thread Synchronisation
Using multi-threading or parallel programming techniques can improve the performance and responsiveness of software but introduces the risk of race conditions that can cause intermittent bugs. These can be mitigated with appropriate locking.
Cancelling Tasks Started with Parallel.InvokeCancelling Tasks Started with Parallel.Invoke
The Parallel.Invoke method provides a simple way to execute multiple tasks in parallel, without the requirement to create Task objects directly or wait for their completion. It also permits the cancellation of the task group via cancellation tokens.
Creating Parallel Tasks with TaskFactoryCreating Parallel Tasks with TaskFactory
The Task Parallel Library provides a number of ways in which parallel tasks can be instantiated. This article describes the use of the TaskFactory class, which uses the factory method design pattern to generate and start tasks with a single method call.
Thread-Safety with the Interlocked ClassThread-Safety with the Interlocked Class
When developing multi-threaded software or using parallel programming techniques, it is essential that classes remain thread-safe. The Interlocked class provides methods that assist with thread safety by performing atomic operations.
Attaching Continuation Tasks to the UI ThreadAttaching Continuation Tasks to the UI Thread
Parallel tasks can be used in Windows Forms and Windows Presentation Foundation applications to run slow processes without blocking the user interface thread. However, this presents a problem, as both systems prevent other threads from updating controls.
AggregateException.WithoutCancellations MethodAggregateException.WithoutCancellations Method
Many parallel operations throw AggregateExceptions when problems occur. These may contain a mixture of real problems and exceptions thrown during cancellation. The WithoutCancellations extension method makes it easy to ignore the cancellation exceptions.
Cancelling Parallel LoopsCancelling Parallel Loops
The Task Parallel Library includes static methods that provide parallel equivalents of the for and foreach loops. As with parallel tasks, these loops can be cancelled by other processes using a system of cancellation tokens.
Parallel LINQParallel LINQ
The fifteenth and final part of the Parallel Programming in .NET tutorial leaves the examination of imperative programming using loops and tasks. It starts the description of declarative programming using Parallel Language-Integrated Query.
<< Previous | 1 | 2 | 3 | 4 | Next >> |