Created
June 18, 2014 18:41
-
-
Save Fhernd/b388995062c9b242e6a7 to your computer and use it in GitHub Desktop.
Demostracón de creación de nuevo thread.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
namespace Recetas.Multithreading.Cap01 | |
{ | |
public sealed class ImpresionNumeros | |
{ | |
public static void Main() | |
{ | |
Thread nuevoThread = new Thread (new ThreadStart (ImprimirNumeros)); | |
nuevoThread.Start(); | |
ImprimirNumeros(); | |
} | |
// Método que se invocará por el thrad de Main, y | |
// el nuevo que creamos dentro ese mismo método: | |
public static void ImprimirNumeros() | |
{ | |
Console.WriteLine ("Iniciando ejecución..."); | |
for (int i = 1; i < 10; ++i) | |
{ | |
Console.WriteLine (i.ToString()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment