QThread::requestInterruption() cannot be undone
-
There are different possible solutions; both shared buffers and signals are valid solutions. I don't know the details of your app though, so I can't tell you which approach is better.
One alternative is to let your SQL thread "pull" data, instead of letting your read thread "push" data -- emit a signal when it wants the read thread to read another line.
By the way, you might consider combining your read thread and parse thread into one, to simplify your code. Is there any benefit in keeping them separate?
These examples might be useful too:
-
Well, thank you JKSH for your help!
Yes I think I can combine file reading and parsing in the same thread. Initially, I wanted the parsing thread to bind the parsed string directly into the prepared statement so that the database thread only have to execute the query. But it was impossible, or very very complicated.