是否有Java的&QUOT之间的差异;同步"和C#的"锁定"? [英] Are there any differences between Java's "synchronized" and C#'s "lock"?

查看:80
本文介绍了是否有Java的&QUOT之间的差异;同步"和C#的"锁定"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

做这两个关键字有相同的效果,或者是有什么我应该知道的?

Do these two keywords have exactly the same effect, or is there something I should be aware of?

推荐答案

据这个网站:<一href=\"http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_CSharp_lock_and_Java_synchronized\" rel=\"nofollow\">http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_CSharp_lock_and_Java_synchronized, C#锁定和Java 同步 code块是语义上相同,而对于方法,Java使用同步,而C#使用一个属性: [MethodImpl(MethodImplOptions.Synchronized)]

According to this site: http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_CSharp_lock_and_Java_synchronized, C# lock and Java synchronized code blocks are "semantically identical", while for methods, Java uses synchronized while C# uses an attribute: [MethodImpl(MethodImplOptions.Synchronized)].

这篇关于是否有Java的&QUOT之间的差异;同步&QUOT;和C#的&QUOT;锁定&QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆