Fix process-thread naming
authorRobin Gareus <robin@gareus.org>
Wed, 10 Jul 2019 18:19:53 +0000 (20:19 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 10 Jul 2019 18:20:44 +0000 (20:20 +0200)
libs/ardour/graph.cc
libs/ardour/luaproc.cc

index 0389b2ef1a0e62e6e06aeeae4a4fa440787f3b65..0c59b0f7c7d83a6890565d527b0af454c9edbf64 100644 (file)
@@ -428,6 +428,16 @@ Graph::run_one()
 void
 Graph::helper_thread()
 {
+       /* This is needed for ARDOUR::Session requests called from rt-processors
+        * in particular Lua scripts may do cross-thread calls */
+       if (! SessionEvent::has_per_thread_pool ()) {
+               char name[64];
+               snprintf (name, 64, "RT-%p", this);
+               pthread_set_name (name);
+               SessionEvent::create_per_thread_pool (name, 64);
+               PBD::notify_event_loops_about_thread_creation (pthread_self(), name, 64);
+       }
+
        suspend_rt_malloc_checks ();
        ProcessThread* pt = new ProcessThread ();
        resume_rt_malloc_checks ();
@@ -450,6 +460,16 @@ Graph::main_thread()
 {
        suspend_rt_malloc_checks ();
        ProcessThread* pt = new ProcessThread ();
+
+       /* This is needed for ARDOUR::Session requests called from rt-processors
+        * in particular Lua scripts may do cross-thread calls */
+       if (! SessionEvent::has_per_thread_pool ()) {
+               char name[64];
+               snprintf (name, 64, "RT-main-%p", this);
+               pthread_set_name (name);
+               SessionEvent::create_per_thread_pool (name, 64);
+               PBD::notify_event_loops_about_thread_creation (pthread_self(), name, 64);
+       }
        resume_rt_malloc_checks ();
 
        pt->get_buffers();
index 8cb5f66c1ca9f0607d72aca59932cdc901b7ed92..04d83862cea6961cbfffde8d36b79ef3516abf25 100644 (file)
@@ -624,13 +624,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
        Plugin::connect_and_run (bufs, start, end, speed, in, out, nframes, offset);
 
        // This is needed for ARDOUR::Session requests :(
-       if (! SessionEvent::has_per_thread_pool ()) {
-               char name[64];
-               snprintf (name, 64, "Proc-%p", this);
-               pthread_set_name (name);
-               SessionEvent::create_per_thread_pool (name, 64);
-               PBD::notify_event_loops_about_thread_creation (pthread_self(), name, 64);
-       }
+       assert (SessionEvent::has_per_thread_pool ());
 
        uint32_t const n = parameter_count ();
        for (uint32_t i = 0; i < n; ++i) {