How does Thread.sleep() work when called from multiple threads

后端 未结 5 1891
暖寄归人
暖寄归人 2021-01-18 05:31

sleep() is a static method of class Thread. How does it work when called from multiple threads. and how does it figure out the current thread of execution. ?

or may

5条回答
  •  自闭症患者
    2021-01-18 05:43

    how does it figure out the current thread of execution?

    It doesn't have to. It just calls the operating system, which always sleeps the thread that called it.

提交回复
热议问题