really set thread priority in SerialInputOutputManager (#349)

pull/351/head v3.3.1
kai-morich 2021-02-23 07:47:35 +01:00
rodzic cbed086279
commit c06ccf70bc
1 zmienionych plików z 2 dodań i 4 usunięć

Wyświetl plik

@ -167,18 +167,16 @@ public class SerialInputOutputManager implements Runnable {
*/ */
@Override @Override
public void run() { public void run() {
if(mThreadPriority != Process.THREAD_PRIORITY_DEFAULT)
setThreadPriority(mThreadPriority);
synchronized (this) { synchronized (this) {
if (getState() != State.STOPPED) { if (getState() != State.STOPPED) {
throw new IllegalStateException("Already running"); throw new IllegalStateException("Already running");
} }
mState = State.RUNNING; mState = State.RUNNING;
} }
Log.i(TAG, "Running ..."); Log.i(TAG, "Running ...");
try { try {
if(mThreadPriority != Process.THREAD_PRIORITY_DEFAULT)
Process.setThreadPriority(mThreadPriority);
while (true) { while (true) {
if (getState() != State.RUNNING) { if (getState() != State.RUNNING) {
Log.i(TAG, "Stopping mState=" + getState()); Log.i(TAG, "Stopping mState=" + getState());