Execution of new thread inside a synchronized block

后端 未结 2 1282
生来不讨喜
生来不讨喜 2021-01-04 04:54

If i create a new thread inside a synchronized block, will the block remain locked till the thread execution is also complete? If not, then till when would it remain locked

2条回答
  •  北海茫月
    2021-01-04 05:21

    no thread has a separate life. synchronized block will be blocked only till starting point of the thread in above case.

提交回复
热议问题