Object thisLock = new Object();
lock (thisLock)
{
//TODO...
}
//等价于
try
{
Monitor.Enter(thisLock);
//TODO...
}
catch (Exception ex) { }
finally
{
Monitor.Exit(thisLock);
}
C# Lock和Monitor
最新推荐文章于 2024-07-16 10:01:54 发布