make DEBUG_THREADED_SIGNALS use a little more efficient at runtime

This commit is contained in:
Paul Davis 2025-04-14 10:08:18 -06:00
parent 7154bbc65d
commit 623df55653

View file

@ -73,12 +73,26 @@ BaseUI::RequestType Gtkmm2ext::AddTimeout = BaseUI::new_request_type();
template class AbstractUI<Gtkmm2ext::UIRequest>; template class AbstractUI<Gtkmm2ext::UIRequest>;
#ifndef NDEBUG
static int debug_call_slot = -1;
#endif
UI::UI (string application_name, string thread_name, int *argc, char ***argv) UI::UI (string application_name, string thread_name, int *argc, char ***argv)
: AbstractUI<UIRequest> (thread_name) : AbstractUI<UIRequest> (thread_name)
, _receiver (*this) , _receiver (*this)
, global_bindings (0) , global_bindings (0)
, errors (0) , errors (0)
{ {
#ifndef NDEBUG
/* one time initialization of this to reduce run time cost in debug builds */
if (debug_call_slot < 0) {
if (g_getenv ("DEBUG_THREADED_SIGNALS")) {
debug_call_slot = 1;
} else {
debug_call_slot = 0;
}
}
#endif
theMain = new Main (argc, argv); theMain = new Main (argc, argv);
char buf[18]; char buf[18];
@ -479,7 +493,7 @@ UI::do_request (UIRequest* req)
} else if (req->type == CallSlot) { } else if (req->type == CallSlot) {
#ifndef NDEBUG #ifndef NDEBUG
if (getenv ("DEBUG_THREADED_SIGNALS")) { if (debug_call_slot) {
cerr << "call slot for " << event_loop_name() << endl; cerr << "call slot for " << event_loop_name() << endl;
} }
#endif #endif