I am working on a C++ application for Linux which must work in, at least, soft realtime. It is multi-threaded (using the C++11 library). I need to output messages to the console to help with debugging. So as not to disturb the timing of critical threads, I run a logging thread on a separate core from the critical processes. Any thread can write console messages to the logging thread's ring buffer (which has a suitable mutex). The logging thread wakes up once per second and empties the buffer to the console (using fprintf(stdout...)). This worked fine in another application but in the current app the console messages don't appear until all threads have terminated. I know that the logging thread is waking up regularly because it generates its own log message when it wakes and empties the ring buffer, each log message has a timestamp, and the timestamps are correct when they eventually appear. For some reason the I/O channel seems to be blocked while the app is running. It seems that even normal cout messages don't get through.
Any thoughts on why the console messages are blocked? Does it mean that the kernel processes on core 0 are blocked?
Aucun commentaire:
Enregistrer un commentaire