Created
May 6, 2013 15:45
-
-
Save huanlin/5525958 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; | |
namespace Ex05_BackgroundThread | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Thread t = new Thread(MyWork); | |
t.IsBackground = true; | |
t.Start(); | |
// 若 t 是前景執行緒,此應用程式不會結束,除非手動將它關閉; | |
// 若 t 是背景執行緒,此應用程式會立刻結束。 | |
} | |
static void MyWork() | |
{ | |
while (true) | |
; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment