task.waitAll

 childref.Start();
            var t1 = Task.Run(() =>
            {
                Console.WriteLine("TaskRun启动的线程:"+Thread.CurrentThread.ManagedThreadId);
            });
            Task.WaitAll(new Task[] { childref, t1 });
            Console.WriteLine("所有线程结束后:"+ Thread.CurrentThread.ManagedThreadId);

 

posted @ 2022-08-18 13:35  vba是最好的语言  阅读(29)  评论(0编辑  收藏  举报