synchronized 加在方法和代码块底层实现区别
摘要:
1、同步方法块 被括起来的块分别有指令:monitorenter 和 monitorexit monitorenter: 从之前的笔记知道,每个对象都有一个监视器锁(monitor),当monitor被占用时就会处于锁定状态。线程就是执行monitorenter命令获取monitor锁的。 1、如果 阅读全文
posted @ 2018-10-10 13:51 植物大戰僵尸 阅读(1466) 评论(0) 推荐(0)
浙公网安备 33010602011771号