线程的优先级用数字表示,范围1-10。
Thread.MIN_PRIORITY = 1 ;
Thread.MAX_PRIORITY= 10;
Thread.NORM_PRIORITY = 5;
获取优先级
getPriority();
设置优先级
setPriority(int a);
注意:
1、优先级的设定在线程启动start()调度前set;
2、优先级低只是意味这个获得调度的概率低,并不是优先级低就不会被调用了,以CPU的调度为准
线程的优先级用数字表示,范围1-10。
Thread.MIN_PRIORITY = 1 ;
Thread.MAX_PRIORITY= 10;
Thread.NORM_PRIORITY = 5;
获取优先级
getPriority();
设置优先级
setPriority(int a);
注意:
1、优先级的设定在线程启动start()调度前set;
2、优先级低只是意味这个获得调度的概率低,并不是优先级低就不会被调用了,以CPU的调度为准