Suspend and Resuem are also not recommended, and are likely to throw some exceptions when used. For example, suspend a synchronization object, which prevents the lock from being interpreted, and other threads will not be able to continue execution while accessing the object. The simplest example could be System.out.println, which is a synchronous method that, if executed in a thread and suspend, cannot continue to use the SYSTEM.OUT.PRINTLN output in the main method because it has been paused and the exclusive resource cannot be interpreted.
Yield method to transfer the current CPU resources to other tasks to perform the use.
setpriority (int) To set the priority level. The priority range is
Min_priority=1,
MAX_PRIORITY=10,
Norm_priority=5
The priority of a thread is inherited, such as a boy thread, and the child thread is the same priority as the boy thread.
This article is from the "Happy Cup of Tea" blog, please be sure to keep this source http://gugw9handsome.blog.51cto.com/1187812/1784204
Java Method suspend\resume\yield\setpriority