有这样的代码:
void MyMethod() {
bool acquired = _lockMutex.WaitOne(WAITING_TIME_SPAN);
if (acquired) {
Proceed();//everything is ok
} else {
actionEnded("Mutex in use!");
}
}
_lockMutex是私有静态作用域。似乎当“同一时间”的2个线程在空闲时尝试获取互斥锁时,它们当前没有获取它。你能解释一下为什么吗?感谢