I am using a SynchronisedQueue
to communicate between threads. I found that destroying the thread object when the attaching thread is waiting on a condition var
The destructor for std::thread
will call std::terminate
if it is run on a thread if you not have called join()
(to wait the thread to finish) or detach()
(to detach the thread from the object) on it.
Your code calls the destructor for worker_thread
without calling join()
or detach()
on it, and so std::terminate
is called. This is unrelated to the presence of condition variables.