abstractui: provide a message if an event loop wakes but finds no work

(this only occurs for debug builds)
This commit is contained in:
Paul Davis 2023-04-21 12:13:25 -06:00
parent 6e65e9c82f
commit 4a2c27ed6d
1 changed files with 14 additions and 0 deletions

View File

@ -217,6 +217,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
{
RequestBufferMapIterator i;
RequestBufferVector vec;
int cnt = 0;
/* check all registered per-thread buffers first */
Glib::Threads::RWLock::ReaderLock rbml (request_buffer_map_lock);
@ -241,6 +242,8 @@ AbstractUI<RequestObject>::handle_ui_requests ()
if (trash.size() > 0) {
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1 items in trash: %2\n", event_loop_name(), trash.size()));
}
bool buf_found = false;
#endif
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1 check %2 request buffers for requests\n", event_loop_name(), request_buffers.size()));
@ -267,6 +270,9 @@ AbstractUI<RequestObject>::handle_ui_requests ()
if (vec.len[0] == 0) {
break;
} else {
#ifndef NDEBUG
buf_found = true;
#endif
if (vec.buf[0]->invalidation && !vec.buf[0]->invalidation->valid ()) {
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: skipping invalidated request\n", event_loop_name()));
rbml.release ();
@ -277,6 +283,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: valid request, calling ::do_request()\n", event_loop_name()));
do_request (vec.buf[0]);
cnt++;
}
/* if the request was CallSlot, then we need to ensure that we reset the functor in the request, in case it
@ -301,6 +308,12 @@ AbstractUI<RequestObject>::handle_ui_requests ()
}
}
#ifndef NDEBUG
if (!buf_found) {
std::cerr << event_loop_name() << " woken, but not request buffers have any requests " << std::endl;
}
#endif
assert (rbml.locked ());
for (i = request_buffers.begin(); i != request_buffers.end(); ) {
if ((*i).second->dead) {
@ -370,6 +383,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
*/
do_request (req);
cnt++;
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 delete heap request type %3\n", event_loop_name(), pthread_name(), req->type));
delete req;