There is a highly unlikely case where the render thread can have zero
requests in the queue, but it is not supposed to be terminated.
1) WaveView::queue_get_image();
wake up thread, *but* the thread does not start yet
2) WaveView::cancel_my_render_request();
and now the thread starts.
1,2 are initiated by user actions from the GUI thread and are normally
orders of magnitude slower than scheduler-thread wakeup.
void
WaveView::stop_drawing_thread ()
{
- if (_drawing_thread) {
+ while (_drawing_thread) {
Glib::Threads::Mutex::Lock lm (request_queue_lock);
g_atomic_int_set (&drawing_thread_should_quit, 1);
request_cond.signal ();
}
if (request_queue.empty()) {
- assert (g_atomic_int_get (&drawing_thread_should_quit));
- continue; // or break;
+ continue;
}
/* remove the request from the queue (remember: the "request"