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#");
}
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwoKbmFtZXNwYWNlIFJlY2V0YXMuVGhyZWFkaW5nLkNhcDAxCnsKCWludGVybmFsIHNlYWxlZCBjbGFzcyBVc29CYXNpY29UaHJlYWRBYm9ydAoJewoJCXB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKCQl7CgkJCVRocmVhZCB0aHJlYWROdWV2byA9IG5ldyBUaHJlYWQgKE1vc3RyYXJNZW5zYWplKTsKCQkJCgkJCWlmICh0aHJlYWROdWV2by5Jc0FsaXZlKQoJCQl7CgkJCQkvLyBJbmljaWEgbGEgZWplY3VjacOzbiBkZWwgbnVldm8gdGhyZWFkOgoJCQkJdGhyZWFkTnVldm8uU3RhcnQoKTsKCQkJCQoJCQkJLy8gRGV0aWVuZSBlbCB0aHJlYWQ6CgkJCQl0aHJlYWROdWV2by5BYm9ydCgpOwoJCQl9CgkJCQoJCQkvLyBDw7NkaWdvIGVqZWN1dGFkbyBlbiBlbCB0aHJlYWQgTWFpbjoKCQkJZm9yIChpbnQgaSA9IDA7IGkgPCAxMDsgKytpKQoJCQl7CgkJCQlDb25zb2xlLldyaXRlTGluZSAoIk9ydGl6T0wgLSB4Q1N3Iik7CgkJCX0KCQkJCgkJCUNvbnNvbGUuV3JpdGVMaW5lICgiXG5FbCB0aHJlYWQgTW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