A very concise question: How do I prove with a simple test, that setting:
android.os.Process.setThreadPriority(int);
actually works?
The reason I post this question is mainly generic, as I can't find a simple test that I can replicate.
Further reading:
It is important to me and my application specifically, as it captures audio, which must be the priority. The audio data is also written to a file as well as being analysed for its properties, which is of less importance - Therefore I don't require these tasks to be 'truly simultaneous'.
In my audio thread, I set:
Process.setThreadPriority(Process.THREAD_PRIORITY_URGENT_AUDIO);
I can simply test the above has 'applied' by checking before and after:
Process.getThreadPriority(Process.myTid());
However, my need for a test is due to the documentation, which states:
Standard priority of the most important audio threads. Applications can not normally change to this priority.
Despite the log output showing the priority changed to -19, my concern, raised by the wording in the documentation, is that the System may not allow a value of -19 for a normal application at the time of execution and it is possibly reserved for System applications only?
If the above is true, I wonder how I could simply prove what happens to this priority value - Is it defaulted to the maximum permitted, or could it be ignored completely?
In regards to the actual test itself, I've experimented with loops and pauses, but without success and I don't trust the results of the attempts I've made. I'm also aware that the behaviour is OS dependent, so perhaps I cannot replicate a stand-alone Java test of which I've failed to find any upvoted examples?
Hope someone can help. Thanks in advance.
EDIT - Further to the initial answers, I do appreciate that the behaviour may not be what I want or expect. I'd like the actual physical test of this please, rather than an explanation of possibilities.
The test would consist of multiple threads running with different priorities and the order they complete in printed out to the log, nothing more complex than that. My attempts were seemingly over-complex, hence I'm asking for assistance here.