Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- namespace Recetas.Threading.Cap01
- {
- internal sealed class UsoBasicoThreadAbort
- {
- public static void Main()
- {
- Thread threadNuevo = new Thread (MostrarMensaje);
- if (threadNuevo.IsAlive)
- {
- // Inicia la ejecución del nuevo thread:
- threadNuevo.Start();
- // Detiene el thread:
- threadNuevo.Abort();
- }
- // Código ejecutado en el thread Main:
- for (int i = 0; i < 10; ++i)
- {
- Console.WriteLine ("OrtizOL - xCSw");
- }
- Console.WriteLine ("\nEl thread Main ha terminado.\n");
- }
- private static void MostrarMensaje ()
- {
- for (int i = 0; i < 10; ++i)
- {
- Console.WriteLine ("Recetas Multithreading en C#");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement