void stop();
void wait_until_finished();
bool transport_work_requested() const;
+ void drop_references ();
float read_data_rate() const; ///< in usec
float write_data_rate() const;
}
}
+void
+Butler::drop_references ()
+{
+ SessionEvent::pool->set_trash (0);
+}
+
+
} // namespace ARDOUR
Stateful::loading_state_version = 0;
+ _butler->drop_references ();
delete _butler;
delete midi_control_ui;
void create_per_thread_pool (std::string name, unsigned long item_size, unsigned long nitems);
CrossThreadPool* per_thread_pool ();
- void set_trash (RingBuffer<CrossThreadPool*>* t) {
- _trash = t;
- }
-
+ void set_trash (RingBuffer<CrossThreadPool*>* t);
void add_to_trash (CrossThreadPool *);
private:
std::string _name;
unsigned long _item_size;
unsigned long _nitems;
+
+ /** mutex to protect either changes to the _trash variable, or writes to the RingBuffer */
+ Glib::Mutex _trash_mutex;
RingBuffer<CrossThreadPool*>* _trash;
- Glib::Mutex _trash_write_mutex;
};
#endif // __qm_pool_h__
return p;
}
+void
+PerThreadPool::set_trash (RingBuffer<CrossThreadPool*>* t)
+{
+ Glib::Mutex::Lock lm (_trash_mutex);
+ _trash = t;
+}
+
/** Add a CrossThreadPool to our trash, if we have one. If not, a warning is emitted. */
void
PerThreadPool::add_to_trash (CrossThreadPool* p)
{
+ Glib::Mutex::Lock lm (_trash_mutex);
+
if (!_trash) {
warning << "Pool " << p->name() << " has no trash collector; a memory leak has therefore occurred" << endmsg;
return;
can only be one writer to the _trash RingBuffer)
*/
- Glib::Mutex::Lock lm (_trash_write_mutex);
_trash->write (&p, 1);
}