An opinion on a console application where there are both QTimer and QThread.
I have an application where there are the QThread and QTimer objects. The objects can meet the same bottleneck when they have to write the log files.
When the the QThread object has to append something to the log files it emits an event. The QTimer appends someting to the log file when the OnTimer event is emitted.
Is this scenario wrong and unstable? Sometimes the application goes to crash and after many days on searching I haven't got any idea on where the bug could be.
There may be a race condition of both writing to log file at same time. That may cause mess up in log file. However i'm sure this may not lead to crash. Are you using any synchronisation mechanism to avoid the race condition between two threads writing to a file ? May be a good idea to try if not tried.
In the log function I'm using a QMutex.
@mrdebug Which thread does the logging? You have a QThread object - does it logging or does the main thread it? Are signals connected between threads or inside one thread? Some kind of architectural explanation or diagram would be useful.