wyosata, you were kind enough in another thread to provide source code to a thread safe queue you developed. It is my understanding, that this implemenation implements a monitor object, providing thread safe mutual exclusion to the objects it controls.
What is also nice about this C++ template is that it will throttle the producer until the consumer has freed up some queue space.
In my current application, I have several secondary threads, none of which run exec() loops because I want them to pend. The secondary threads will likely have a higher priority than the main GUI thread.
The secondary thread within its thread context will pass data to the primary GUI thread via your thread safe queue.
Do you see any potential priority inversion condition that could occur wherein the GUI thread, having a lower priority than the producer thread, would be indirectly preempted by the lower priority GUI thread effectively "inverting" the relative priorities of the two tasks?
I was doing some reading on how POSIX threads, and speciifically how the Pthread mutex has a provision to handle this condition via priority inheritence or ceiling. However, in looking through the Qt source code, it is clear that Qt's implementation of QMutex does
not have these provisions.
I was wondering if a simple derivation from QMutex might suffice, or in the case of your fine thread safe template, perhaps a derivation from QSemaphore to ensure that a priority inversion solution is in place.
Do you have any thoughts on this?
Bookmarks