I am using boost :: thread to process messages in a queue. When the first message arrives, I start the message processing thread. When the second message arrives, I check if the message processing thread is running.
if it is done, I start a new one if it is not done, I do nothing.
How do I know if a thread is running? I tried with joinable (), but it does not work, since when the thread executes, it is still available for connection.
I also tried to abort the process right away and add a breakpoint at the end of my thread, but that didn't work.
thanks
EDIT:
I want my thread to sleep indefinitely and wake up when a signal is triggered.
Average value - boost :: condition_variable
source share