Java threads and synchronized blocks

前端 未结 3 587
心在旅途
心在旅途 2021-02-14 18:09

Suppose I\'m executing a synchronized block of code inside some thread and within the synchronized block I call a method that spawns another thread to

3条回答
  •  感动是毒
    2021-02-14 18:44

    You are still holding the lock during the creation of runnable and the thread, but after you call start and before the thread actually picks up you are relinquishing the lock. The new thread will have to compete for the lock with other threads.

提交回复
热议问题