Nested synchronized keyword

后端 未结 6 812
迷失自我
迷失自我 2020-12-29 01:30

I have this code in Java:

    public void doSomeThing() {
        synchronized (this) {
            doSomeThingElse();
        }
    }
    public void doSome         


        
6条回答
  •  青春惊慌失措
    2020-12-29 02:11

    If a thread owns the lock on this, it will go into other synchronized methods/block like hot knife in butter.

提交回复
热议问题