using System; using System.Threading; namespace Recetas.Multithreading.Cap01 { internal sealed class UsoBasicoThreadAbort { public static void Main() { Thread nuevoThread = new Thread( delegate() { Console.WriteLine ("\nDentro del thread `nuevoThread`..."); // Ciclo infinito... // Será interrumpido por nuevoThread.Abort() en // el thread Main: while(true); } ); nuevoThread.Start(); // Permite que el thread nuevoThread se ejecute // durante 2 segundos: Thread.Sleep (2000); // Aborta la ejecución del thread: nuevoThread.Abort(); Console.WriteLine (); } } }