lock ( expression ) embedded-statement
The expression of a lock statement must denote a value of a reference-type.
No implicit boxing conversion
(§13.1.5) is ever performed for the expression of a lock statement, and
thus it is a compile-time error for the
expression to denote a value of a value-type.
A lock statement of the form
lock (x) .
where x is an expression of a reference-type, is precisely equivalent to
System.Threading.Monitor.Enter(x);
try {
.
}
finally {
System.Threading.Monitor.Exit(x);
}
except that x is only evaluated once.
[Example: The System.Type object of a class can conveniently be used as the
mutual-exclusion lock for
static methods of the class. For example:
class Cache
{
public static void Add(object x) {
lock (typeof(Cache)) {
.
}
}
public static void Remove(object x) {
lock (typeof(Cache)) {
.
}
}
}
end example]
分享到:
相关推荐
aspose-words-15.12.0-jdk16.jar 用于操作将word文档转换为pdf文档的工具包,内还包含授权去除pdf水印标记的xml。详细操作使用,请参考我的文章链接:...
CCS5.5导入工程时出现See details below. Error: Import failed for project 'can_external_transmit_cpu01' because its compiler ... Please install the C2000v15.12 compiler before importing this project.
Intel英特尔Graphics Media Accelerator 3150集成显卡驱动15.12.75.50.11.2567版For Win7-32(2013年9月16日发布) GMA 3150集成显卡驱动,官网就已经快很久没更新了,这可苦了我们广大上网本用户。好在经过我们的...
资源来自pypi官网。 资源全名:libraptorq-15.12.3.tar.gz
Intel英特尔Graphics Media Accelerator 3150集成显卡驱动15.12.75.50.11.64.2567版For Win7-64(2013年9月16日发布) GMA 3150集成显卡驱动,官网就已经快很久没更新了,这可苦了我们广大上网本用户。好在经过我们...
灰常强大的进程查看器,Process Explorer 15.12.rar
UPUPW PHP探针安全版 15.12.5 更新日志: 1、修复安全版---数据库连接处如果被外部工具激活input输入框,可用任意数据库地址模拟测试连接数据库成功,进而来显示隐藏的配置和站点路径。 UPUPW PHP探针安全版页面...
Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 ...
Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 ...
神舟战神K650D-i5-D1之黑苹果10.11.1EFI文件(15.12.2)
51单片机实现6*6矩阵键盘,并附带消抖,及常按按键按下及释放检测,不用等待延时,占用CPU时间,通过循环延时。
UPUPW PHP探针通用版简介 UPUPW PHP探针通用版,优势:支持最新PHP7.0系列版本,完全兼容PHP5.2-PHP5.6组件和参数的... ... 01、支持服务器域名及端口检测。 02、支持服务器环境webserver检测。...同类推荐:站长常用源码
英特尔GMA3150显卡驱动Forwin7是一款适配win7系统的电脑显卡驱动,能帮用户解决电脑运行速度慢的问题,增强用户体验,欢迎大家下载。驱动介绍:图形核心GMA3150PineTrailAtom平台处理器整合的图形核心名为amp;...
Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 ...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
Frontline15.12 用于解析蓝牙协议及流程分析