Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question"[...] or alternatively, use the thread's IsAlive property. IsAlive, however, might not be what you want. It returns true if the thread's blocked or suspended (the only time it returns false is before the thread has started, and after it has ended)."
//un sépmaphore critique, libre par défaut static AutoResetEvent autoResetEvent = new AutoResetEvent(true);
private void BuildCurveGraph() { System.Diagnostics.Debug.WriteLine("Thread waiting"); // le Wait one sur une auto reset event permet d'attendre qu'il soit libre et de le bloquer automatiquement autoResetEvent.WaitOne(); // si on est ici c'est que les autres thread sont terminés ou bloqués sur le sémaphore System.Diagnostics.Debug.WriteLine("Thread starting"); try { // .. ici le code du thread .. Thread.Sleep(3000); } finally { System.Diagnostics.Debug.WriteLine("Thread finishing..."); autoResetEvent.Set(); } }