If I want grant a Thread a low priority whats the correct call?
Thread t= new Thread(r);
t.setPriority(Thread.MIN_PRIORITY);
or
Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);
Or maybe should I combine both? If yes is the order of this calls important? Thanks
t.setPriority(int)will set the priority onThread t. This can not be used to set a Thread’s priority higher than the receiver’sThreadGroup.Process.setThreadPriority(int, int)takes an additional argument, so that you can set the priority on any Thread (granted aSecurityExceptionis not thrown).Also notice the integer value of
Thread.MIN_PRIORITY(1) andProcess.THREAD_PRIORITY_LOWEST(19).