Serial Thread Priority
After adding the dials for representing sensors in a more graphical way, random serial I/O problems occured resulting in incorrect figures being obtained.
The solution was to increase the priority of the serial I/O thread to higher than the rest. By default it inherits the same priority from the calling thread but this isn’t enough.
I started my thead with the QThread::TimeCriticalPriority enumerated type. This seems to have solved the problem. If I discover any more problems, i will attempt setting the whole processor priority higher using the Linux nice command.
The QT Thread priority types are:
| QThread::IdlePriority | 0 | scheduled only when no other threads are running. |
| QThread::LowestPriority | 1 | scheduled less often than LowPriority. |
| QThread::LowPriority | 2 | scheduled less often than NormalPriority. |
| QThread::NormalPriority | 3 | the default priority of the operating system. |
| QThread::HighPriority | 4 | scheduled more often than NormalPriority. |
| QThread::HighestPriority | 5 | scheduled more often than HighPriority. |
| QThread::TimeCriticalPriority | 6 | scheduled as often as possible. |
| QThread::InheritPriority | 7 | use the same priority as the creating thread. This is the default. |
Leave a Reply
Tags
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | ||||
Blogroll
QT Programming
Single Board Computers (SBCs)
Recent Comments
- Donal on QT and QExtSerialPort
- Dmitriy on QT and QExtSerialPort
- Donal on QT and QExtSerialPort
- Dmitriy on QT and QExtSerialPort
- Donal on Not Finished Yet! - Moving to EABI