allow zero-input (i.e. tone generator) processors to be added
[ardour2.git] / libs / pbd / event_loop.cc
blob67fa6cf49a5c132ecacbd9aca1ced2b60b8bdfc5
1 #include <iostream>
2 #include "pbd/event_loop.h"
3 #include "pbd/stacktrace.h"
5 using namespace PBD;
6 using namespace std;
8 Glib::StaticPrivate<EventLoop> EventLoop::thread_event_loop;
10 static void do_not_delete_the_loop_pointer (void*) { }
12 EventLoop*
13 EventLoop::get_event_loop_for_thread() {
14 return thread_event_loop.get ();
17 void
18 EventLoop::set_event_loop_for_thread (EventLoop* loop)
20 thread_event_loop.set (loop, do_not_delete_the_loop_pointer);
23 /** Called when a sigc::trackable that was connected to using the invalidator() macro
24 * is destroyed.
26 void*
27 EventLoop::invalidate_request (void* data)
29 InvalidationRecord* ir = (InvalidationRecord*) data;
31 if (ir->event_loop) {
32 Glib::Mutex::Lock lm (ir->event_loop->slot_invalidation_mutex());
33 for (list<BaseRequestObject*>::iterator i = ir->requests.begin(); i != ir->requests.end(); ++i) {
34 (*i)->valid = false;
35 (*i)->invalidation = 0;
37 delete ir;
40 return 0;