【发布时间】:2018-02-17 19:53:50
【问题描述】:
我有以下代码:
ThreadStart starter;
Thread worker_thread = null;
starter = Work;
starter += () => { AnotherWork();};
worker_thread = new Thread(starter) { IsBackground = true };
worker_thread.Start();
我想确保 AnotherWork 函数仅在 Work 函数执行完成后运行。但我不确定这段代码是否会按预期运行。
【问题讨论】:
-
这个用任务库比较方便,看看this answer regarding chaining of tasks
标签: c# multithreading