复制代码 代码如下:
//_rwLock的类型是ReaderWriterLock
_rwLock.AcquireWriterLock(100);
DoSomething();
_rwLock.ReleaseWriterLock();
复制代码 代码如下:
try
{
_rwLock.AcquireWriterLock(100);
DoSomething();
}
finally
{
if (_rwLock.IsWriterLockHeld)
_rwLock.ReleaseWriterLock();
}
新闻热点
疑难解答
图片精选