Created
May 5, 2013 16:32
-
-
Save huanlin/5521311 to your computer and use it in GitHub Desktop.
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; | |
class Program | |
{ | |
static void Main(strin g[] args) | |
{ | |
Thread t1 = new Thread(MyBackgroundTask); | |
t1.Start(); | |
for (int i = 0; i < 500; i++) | |
{ | |
Console.Write("."); | |
} | |
} | |
static void MyBackgroundTask() | |
{ | |
for (int i = 0; i < 500; i++) | |
{ | |
Console.Write("[" + Thread.CurrentThread.ManagedThreadId + "]"); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment