Skip to content

Instantly share code, notes, and snippets.

@huanlin
Created May 6, 2013 15:45
Show Gist options
  • Save huanlin/5525958 to your computer and use it in GitHub Desktop.
Save huanlin/5525958 to your computer and use it in GitHub Desktop.
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