System.Threading.Tasks.ParallelLoopState.Stop Method

Communicates that the System.Threading.Tasks.Parallel loop should cease execution at the system's earliest convenience.

Syntax

public void Stop ()

Remarks

ParallelLoopState.Stop may be used to communicate to the loop that no other iterations need be run.

For long-running iterations that may already be executing, ParallelLoopState.Stop causes ParallelLoopState.IsStopped to return true for all other iterations of the loop, such that another iteration may check ParallelLoopState.IsStopped and exit early if it's observed to be true.

ParallelLoopState.Stop is typically employed in search-based algorithms, where once a result is found, no other iterations need be executed.

Requirements

Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0