Parallel Klas
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Biedt ondersteuning voor parallelle lussen en regio's.
public ref class Parallel abstract sealed
public static class Parallel
type Parallel = class
Public Class Parallel
- Overname
-
Parallel
Voorbeelden
In dit voorbeeld ziet u verschillende benaderingen voor het implementeren van een parallelle lus met behulp van meerdere taalconstructies.
using System.Threading.Tasks;
class Test
{
static int N = 1000;
static void TestMethod()
{
// Using a named method.
Parallel.For(0, N, Method2);
// Using an anonymous method.
Parallel.For(0, N, delegate(int i)
{
// Do Work.
});
// Using a lambda expression.
Parallel.For(0, N, i =>
{
// Do Work.
});
}
static void Method2(int i)
{
// Do work.
}
}
Imports System.Threading.Tasks
Module Module1
Sub Main()
Dim N As Integer = 1000
' Using a named method
Parallel.For(0, N, AddressOf Method2)
' Using a lambda expression.
Parallel.For(0, N, Sub(i)
' Do Work
End Sub)
End Sub
Sub Method2(ByVal i As Integer)
' Do work.
End Sub
End Module
Opmerkingen
De Parallel klasse biedt parallelle vervangingen van gegevens op basis van bibliotheken voor algemene bewerkingen, zoals voor lussen, voor elke lussen en het uitvoeren van een set instructies.
Methoden
| Name | Description |
|---|---|
| For(Int32, Int32, Action<Int32,ParallelLoopState>) |
Voert een |
| For(Int32, Int32, Action<Int32>) |
Hiermee wordt een |
| For(Int32, Int32, ParallelOptions, Action<Int32,ParallelLoopState>) |
Voert een |
| For(Int32, Int32, ParallelOptions, Action<Int32>) |
Hiermee wordt een |
| For(Int64, Int64, Action<Int64,ParallelLoopState>) |
Voert een |
| For(Int64, Int64, Action<Int64>) |
Hiermee wordt een |
| For(Int64, Int64, ParallelOptions, Action<Int64,ParallelLoopState>) |
Hiermee wordt een |
| For(Int64, Int64, ParallelOptions, Action<Int64>) |
Hiermee wordt een |
| For<TLocal>(Int32, Int32, Func<TLocal>, Func<Int32,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Hiermee wordt een |
| For<TLocal>(Int32, Int32, ParallelOptions, Func<TLocal>, Func<Int32,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Voert een |
| For<TLocal>(Int64, Int64, Func<TLocal>, Func<Int64,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Voert een |
| For<TLocal>(Int64, Int64, ParallelOptions, Func<TLocal>, Func<Int64,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Voert een |
| ForEach<TSource,TLocal>(IEnumerable<TSource>, Func<TLocal>, Func<TSource,ParallelLoopState,Int64,TLocal,TLocal>, Action<TLocal>) |
Voert een bewerking |
| ForEach<TSource,TLocal>(IEnumerable<TSource>, Func<TLocal>, Func<TSource,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Voert een bewerking |
| ForEach<TSource,TLocal>(IEnumerable<TSource>, ParallelOptions, Func<TLocal>, Func<TSource,ParallelLoopState,Int64,TLocal,TLocal>, Action<TLocal>) |
Hiermee wordt een bewerking |
| ForEach<TSource,TLocal>(IEnumerable<TSource>, ParallelOptions, Func<TLocal>, Func<TSource,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Voert een bewerking |
| ForEach<TSource,TLocal>(OrderablePartitioner<TSource>, Func<TLocal>, Func<TSource,ParallelLoopState,Int64,TLocal,TLocal>, Action<TLocal>) |
Voert een bewerking |
| ForEach<TSource,TLocal>(OrderablePartitioner<TSource>, ParallelOptions, Func<TLocal>, Func<TSource,ParallelLoopState,Int64,TLocal,TLocal>, Action<TLocal>) |
Voert een bewerking |
| ForEach<TSource,TLocal>(Partitioner<TSource>, Func<TLocal>, Func<TSource,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Voert een bewerking |
| ForEach<TSource,TLocal>(Partitioner<TSource>, ParallelOptions, Func<TLocal>, Func<TSource,ParallelLoopState,TLocal,TLocal>, Action<TLocal>) |
Voert een bewerking |
| ForEach<TSource>(IEnumerable<TSource>, Action<TSource,ParallelLoopState,Int64>) |
Hiermee wordt een bewerking |
| ForEach<TSource>(IEnumerable<TSource>, Action<TSource,ParallelLoopState>) |
Voert een bewerking |
| ForEach<TSource>(IEnumerable<TSource>, Action<TSource>) |
Hiermee wordt een bewerking |
| ForEach<TSource>(IEnumerable<TSource>, ParallelOptions, Action<TSource,ParallelLoopState,Int64>) |
Voert een bewerking |
| ForEach<TSource>(IEnumerable<TSource>, ParallelOptions, Action<TSource,ParallelLoopState>) |
Voert een bewerking |
| ForEach<TSource>(IEnumerable<TSource>, ParallelOptions, Action<TSource>) |
Voert een bewerking |
| ForEach<TSource>(OrderablePartitioner<TSource>, Action<TSource,ParallelLoopState,Int64>) |
Hiermee wordt een bewerking |
| ForEach<TSource>(OrderablePartitioner<TSource>, ParallelOptions, Action<TSource,ParallelLoopState,Int64>) |
Hiermee voert u een bewerking |
| ForEach<TSource>(Partitioner<TSource>, Action<TSource,ParallelLoopState>) |
Hiermee wordt een bewerking |
| ForEach<TSource>(Partitioner<TSource>, Action<TSource>) |
Hiermee wordt een bewerking |
| ForEach<TSource>(Partitioner<TSource>, ParallelOptions, Action<TSource,ParallelLoopState>) |
Hiermee voert u een bewerking |
| ForEach<TSource>(Partitioner<TSource>, ParallelOptions, Action<TSource>) |
Voert een bewerking |
| Invoke(Action[]) |
Hiermee worden alle opgegeven acties uitgevoerd, mogelijk parallel. |
| Invoke(ParallelOptions, Action[]) |
Voert elk van de opgegeven acties uit, mogelijk parallel, tenzij de bewerking wordt geannuleerd door de gebruiker. |
Van toepassing op
Veiligheid thread
Alle openbare en beveiligde leden van Parallel zijn thread-veilig en kunnen gelijktijdig worden gebruikt vanuit meerdere threads.