Bonjour,
je suis bloqué pour arrêter Parallel.ForEach avec CancellationTokenSource, pouvez-m'aider a résoudre mon problème pour arrêter !
voici mon code :
avez-vous une autre solution pour arrêter avec Parallel.ForEach?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 'START task.Factory.StartNew(Sub() While Not cts.IsCancellationRequested Parallel.ForEach(ListProxy, New ParallelOptions With {.MaxDegreeOfParallelism = Threads_1, .CancellationToken = cts.Token}, Sub(adress As String) 'Mon code lire proxy End Sub) End While End Sub, cts.Token) 'Button 2 cts.Cancel()
Partager