PIIODevice::waitThreadedReadFinished now periodically (100 ms) call interrupt()
This commit is contained in:
@@ -232,7 +232,16 @@ void PIIODevice::terminateThreadedRead() {
|
||||
|
||||
|
||||
bool PIIODevice::waitThreadedReadFinished(int timeout_ms) {
|
||||
return read_thread.waitForFinish(timeout_ms);
|
||||
PITimeMeasurer tm, tm_intr;
|
||||
while (read_thread.isRunning()) {
|
||||
if (tm.elapsed_m() > timeout_ms) return false;
|
||||
if (tm_intr.elapsed_m() > 100.) {
|
||||
tm_intr.reset();
|
||||
interrupt();
|
||||
}
|
||||
piMinSleep();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user