线程的优先级
时间:2006-08-07 来源:奋斗的蕃茄
线程的优先级
线程的优先级用数字来表示,范围从1到10,即Thread.MIN_PRIORITY到Thread.MAX_PRIORITY。一个线程的缺省优先级是5,即Thread.NORM_PRIORITY。下述方法可以对优先级进行操作:
int getPriority(); //得到线程的优先级
void setPriority(int newPriority);
//当线程被创建后,可通过此方法改变线程的优先级
线程的优先级用数字来表示,范围从1到10,即Thread.MIN_PRIORITY到Thread.MAX_PRIORITY。一个线程的缺省优先级是5,即Thread.NORM_PRIORITY。下述方法可以对优先级进行操作:
int getPriority(); //得到线程的优先级
void setPriority(int newPriority);
//当线程被创建后,可通过此方法改变线程的优先级
相关阅读 更多 +