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 on Thread t. This can not be used to set a Thread's priority higher than the receiver's ThreadGroup.
Process.setThreadPriority(int, int) takes an additional argument, so that you can set the priority on any Thread (granted a SecurityException is not thrown).
Also notice the integer value of Thread.MIN_PRIORITY (1) and Process.THREAD_PRIORITY_LOWEST (19).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With