mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
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.
This commit is contained in:
parent
62b06fa427
commit
a95be76741
3 changed files with 85 additions and 125 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue