var tThreads = new Thread[nbCoeurs * factCoeurs]; // factCoeur détermine juste combien de threads je met par coeurs for (int i = 0; i < nbCoeurs * factCoeurs; i++) { tThreads[i] = new Thread(RemplirASC); tThreads[i].Name = i.ToString(); tThreads[i].Priority = ThreadPriority.AboveNormal; tThreads[i].Start(); } for (int i = 0; i < nbCoeurs * factCoeurs; i++) tThreads[i].Join(); public static void RemplirASC() { int indexThread= int.Parse(Thread.CurrentThread.Name); for (int i = indexThread; i < VariablesCollection.Count; i += nbCoeurs * factCoeurs) { // Blabla } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionint indexThread= int.Parse(Thread.CurrentThread.Name); for (int i = indexThread; i < 100000000; i += nbThreads) Console.WriteLine(i);
int indexThread= int.Parse(Thread.CurrentThread.Name); string test = "blabla"; for (int i = indexThread; i < 100000000; i += nbThreads) test += "," + test;
int indexThread= int.Parse(Thread.CurrentThread.Name); string test = "blabla"; for (int i = indexThread; i < 100000000; i += nbThreads) test += "," + test;
pas trop étonnant que la conso CPU ne soit pas à fond