And*_*ith 10
Lock是一个监视器,用于保证一次只能执行1个线程.
lock(myobj)
{
// only 1 thread here
}
Run Code Online (Sandbox Code Playgroud)
在执行继续之前,Join用于等待线程完成.
anotherThread.Join();
// execution here only when anotherThread is complete
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1157 次 |
| 最近记录: |