Similarities and differences sleep () and wait () of

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_44675837/article/details/102765597

The same point: Once method execution, you can make the current process to enter the blocked state

Similarities and differences: 1. Statement sleep position different from the two methods declared in the thread class, wait object class declaration in
a different call of claim 2, sleep can be called at any desired scene, wait to be called in the synchronization code block
3 With regard to synchronization monitor whether the release: If two sync methods are called in the code block, sleep is not released, wait release.

Guess you like

Origin blog.csdn.net/qq_44675837/article/details/102765597