首页 > 代码库 > 线程的优先级设置

线程的优先级设置

1 Thread.currentThread().setPriority(Thread.MAX_PRIORITY);//高优先级2 3 Thread.currentThread().setPriority(Thread.MIN_PRIORITY);//低优先级

设置优先级时应该通过currentThread()来获取当前的Thread对象,以此Thread对象调用setPriority()来设置优先级;

线程的优先级设置