Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有谁知道.NET 如何处理调用超时Semaphore.WaitOne(timeout)?
Semaphore.WaitOne(timeout)
我希望有一个TimeoutException,但 MSDN 文档没有在预期异常列表中列出它,而且我似乎无法在任何地方找到它的文档。
TimeoutException
false如果超时,该方法将返回,true如果它返回一个信号:
false
true
if (mySemaphore.WaitOne(1000)) { // signal received } else { // wait timed out }