Delete cross-thread pools when the thread terminates if they are empty. Hopefully fixes #3094.
git-svn-id: svn://localhost/ardour2/branches/3.0@7022 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
09f856c1a1
commit
d57a472c16
@ -157,8 +157,19 @@ free_per_thread_pool (void* ptr)
|
||||
CrossThreadPool* cp = static_cast<CrossThreadPool*> (ptr);
|
||||
assert (cp);
|
||||
|
||||
if (cp->empty()) {
|
||||
/* This CrossThreadPool is already empty, and the thread is finishing so nothing
|
||||
* more can be added to it. We can just delete the pool.
|
||||
*/
|
||||
delete cp;
|
||||
} else {
|
||||
/* This CrossThreadPool is not empty, meaning that there's some Events in it
|
||||
* which another thread may yet read, so we can't delete the pool just yet.
|
||||
* Put it in the trash and hope someone deals with it at some stage.
|
||||
*/
|
||||
cp->parent()->add_to_trash (cp);
|
||||
}
|
||||
}
|
||||
|
||||
PerThreadPool::PerThreadPool ()
|
||||
: _trash (0)
|
||||
|
Loading…
Reference in New Issue
Block a user