KGySoft.Threading Namespace

KGy SOFT Core Libraries Help
Contains the static AsyncHelper class that makes possible to implement sync and async versions of a possibly parallel operation supporting cancellation and reporting progress using a single shared implementation. One built-in example is the ParallelHelper class (which is basically a target platform independent advanced version of Parallel.For) but you can find many examples in other dependent libraries such as the KGySoft.Drawing.Core package that uses many parallel operations for image processing. Apart from these you can find here the WaitHandleExtensions and some other types related to configuring or tracking asynchronous operations.
If you are looking for thread-safe collections such as the ThreadSafeDictionaryTKey, TValue, then see the KGySoft.Collections namespace instead.

Public classAsyncConfig
Represents asynchronous configuration for IAsyncResult-returning methods.
Public classAsyncConfigBase
Represents the base class for configuration of possibly asynchronous and multi-threaded operations.
See the Examples section of the AsyncHelper class for details.
Public classCode exampleAsyncHelper
A helper class to implement CPU-bound operations with adjustable parallelization, cancellation and progress reporting, allowing a single shared implementation for both sync and async overloads where the latter can be either IAsyncResult or Task (.NET Framework 4.0 and later) returning methods.
See the Examples section for an example.
Public classParallelConfig
Represents a configuration for parallel operations.
Public classParallelHelper
The ParallelHelper class contains similar methods than the Parallel.For overloads in .NET Framework 4.0 and later but the ones in this class can be used even on .NET Framework 3.5 and support reporting progress and have async overloads.
Public classTaskConfig
Represents asynchronous configuration for Task-returning methods.
Public classWaitHandleExtensions
Provides extension methods for the WaitHandle type.

Public structureAsyncProgressT
Represents the progress of an operation that can be reported by an IAsyncProgress implementation.

Public interfaceIAsyncContext
Represents the context of a possibly asynchronous operation.
See the Examples section of the AsyncHelper class to see how to create sync and async methods (supporting both Task and IAsyncResult return types) using the same shared implementation with an IAsyncContext parameter.
Public interfaceCode exampleIAsyncProgress
Represents a progress updates provider for asynchronous operations. It provides methods for updating the progress from concurrent threads.
See the Examples section for an example implementation.