Created
April 20, 2011 01:35
-
-
Save iraSenthil/930152 to your computer and use it in GitHub Desktop.
Each thread has a separate stack
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
static void Main(string[] args) | |
{ | |
//Thread has separate call stack | |
Thread newThread = new Thread(()=> Print(5)); | |
newThread.Start(); | |
Print(3); | |
Console.ReadLine(); | |
} | |
static void Print(int x) | |
{ | |
for (int i = 0; i < x; i++) | |
{ | |
Console.Write(x); | |
Thread.Sleep(10); | |
} | |
} | |
//Output | |
//53535355 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment