Hallo,
ich habe in meiner static main folgenden Code:
while(true)
{
getuidinfo(uidteil + i);
i++;
}
Die Methode getuidinfo, wird nun immer mit einer anderen nummer aufgerufen und schreibt einen Wert in einen Textfile.
Wenn ich nun einen neuen Thread starte, wie limitiere ich, dass zB diese getuidinfo immer nur 10 Stück parallel laufen ?
Unsere Website
iPhone Programmierung | Android Programmierung
Keine Lust in die Dokumentation zu schauen?
Parallel Loops
> Controlling the Degree of Parallelism
The term degree of parallelism can be used in two senses. In the simplest case, it refers to the number of cores that are used to process iterations simultaneously. However, .NET also uses this term to refer to the number of tasks that can be used simultaneously by the parallel loop. For example, the MaxDegreeOfParallelism property of the ParallelOptions object refers to the maximum number of worker tasks that will be scheduled at any one time by a parallel loop.
- performance is a feature -
Microsoft MVP - @Website - @AzureStuttgart - github.com/BenjaminAbt - Sustainable Code