What's the difference between Thread.setPriority() and android.os.Process.setThreadPriority()

前端 未结 3 471
臣服心动
臣服心动 2020-12-22 23:45

If I have code like:

Runnable r = ...;

Thread  thread = new Thread(r);
thread.setPriority((Thread.MAX_PRIORITY + Thread.NORM_PRIORITY) / 2);
3条回答
  •  执笔经年
    2020-12-23 00:05

    Google uses

    Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
    

    in Volley's Network Dispatcher thread, so I would believe that using Process.setThreadPriority() is the way to go.

提交回复
热议问题