I have a background worker thread which is constantly processing data.
(created using std::thread
)
If the thread runs out of data to process, the thread is designed to wait - and then resume when mote data becomes available for processing.
(using std::condition_variable
)
If this thread ever terminates unexpectedly, I want to ensure the thread is restarted in a fresh state.
But I don't know how to detect thread termination, or react to it.
What's the best way to approach this scenario?