using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; namespace ListenTheadTest { class Program { //set a listening tread to listen the meaure of main thread static int test = 0; static void Main(string[] args) {
//利用主线程建一个新线程 Thread myThread = new Thread(TestFunction); myThread.Start(); test = 5; Console.ReadLine(); } static void TestFunction() { if (test == 5) { Console.WriteLine("five"); } return; } } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-13 09:17:30