Is it possible for a thread to Deadlock itself?

后端 未结 20 1329
暗喜
暗喜 2020-12-02 09:29

Is it technically possible for a thread in Java to deadlock itself?

I was asked this at an interview a while back and responded that it wasn\'t possible but the inte

20条回答
  •  温柔的废话
    2020-12-02 09:40

    When a thread enters the synchronized block, it checks if the current thread is the owner of the lock, and if it is, the the thread just proceeds without waiting.

    So I don't think it is possible.

提交回复
热议问题