+void
+SessionEventManager::clear_events (SessionEvent::Type type, boost::function<void (void)> after)
+{
+ SessionEvent* ev = new SessionEvent (type, SessionEvent::Clear, SessionEvent::Immediate, 0, 0);
+ ev->rt_slot = after;
+
+ /* in the calling thread, after the clear is complete, arrange to flush things from the event
+ pool pending list (i.e. to make sure they are really back in the free list and available
+ for future events).
+ */
+
+ ev->event_loop = PBD::EventLoop::get_event_loop_for_thread ();
+ if (ev->event_loop) {
+ ev->rt_return = boost::bind (&CrossThreadPool::flush_pending_with_ev, ev->event_pool(), _1);
+ }
+
+ queue_event (ev);
+}