summaryrefslogtreecommitdiff
path: root/libs/pbd/event_loop.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-12-15 06:11:20 +0100
committerRobin Gareus <robin@gareus.org>2016-12-15 06:11:30 +0100
commita95be76741c29a6ec1eb9684eed1696b3fb405d6 (patch)
tree60445d9519f26bf6bd5228caaffbbfdae50cb450 /libs/pbd/event_loop.cc
parent62b06fa427b4f432f82510f51e4b6920280b17a8 (diff)
rework request invalidation
This kills 2 birds with 1 stone: Removes the necessity of locks and makes call_slot() realtime safe (req->invalidation->requests list push_back). On object destruction, the invalidation-record (IR) itself is invalidated. Invalidated IRs are pushed onto a trash-pool and deleted in the event-loop of the invalidated object (GUI thread) once all requests that reference it have been processed. One last detail remains: PBD::signal connect should reference the IR and disconnect unreference it. This will guarantee that signal emission will not reference the IR while the pool trash is dropped.
Diffstat (limited to 'libs/pbd/event_loop.cc')
-rw-r--r--libs/pbd/event_loop.cc13
1 files changed, 2 insertions, 11 deletions
diff --git a/libs/pbd/event_loop.cc b/libs/pbd/event_loop.cc
index aae0c21a08..f72255dd72 100644
--- a/libs/pbd/event_loop.cc
+++ b/libs/pbd/event_loop.cc
@@ -88,18 +88,9 @@ EventLoop::invalidate_request (void* data)
if (ir->event_loop) {
DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: EventLoop::invalidate_request %2\n", ir->event_loop, ir));
- {
- Glib::Threads::Mutex::Lock lm (ir->event_loop->slot_invalidation_mutex());
- for (list<BaseRequestObject*>::iterator i = ir->requests.begin(); i != ir->requests.end(); ++i) {
- (*i)->invalidate ();
- (*i)->invalidation = 0;
- }
- }
- // This invalidation record may still be in-use in per-thread-request-ringbuffer.
- // it cannot be deleted here,
+ Glib::Threads::Mutex::Lock lm (ir->event_loop->slot_invalidation_mutex());
+ ir->invalidate ();
ir->event_loop->trash.push_back(ir);
- } else {
- DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("EventLoop::invalidate_request no event-loop for invalidation %1\n", ir));
}
return 0;