Threads:
I have a thread that is explicitly focused on monitoring for events--Producer Thread. The thread runs a loop which checks for an event to happen in hardware. When an event is triggered, an integer is generated. The event needs to be pushed to a second, Worker, thread. Note: Events can be triggered within microseconds of each other.
The worker thread needs to run some analytics on each triggered event and display it to the Gui.
Event Variable Question:
Based on the above, my question is on the correct variable type to use for the events variable a QQueue or Buffer/Semaphore combination?
Requirements:
- The Producer Thread should have minimal to no delays to avoid missing an event
- The events shall be processed and not overwritten by a second event
My Understanding:
As I understand it, in this instance of thread use, a mutex would be needed for use of the QQueue which could possibly create some delay in the producer thread writing an event to the Queue. --Please confirm this as well.
Thanks for the help.
Bookmarks