summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/session_event.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-02-05 16:20:09 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2015-02-05 16:32:21 -0500
commit6790f8342aa9dd0897336b420f7bc19d40884f55 (patch)
tree671efbd96f7e7849e090214fc96f0e2a899e8c7f /libs/ardour/ardour/session_event.h
parent4010884a5b898e79c32984a9355c37ad0a01a67b (diff)
expand SessionEvent API to allow ::clear_events() to work correctly.
clear_events() must run in realtime context, which is likely to be asynchronous with respect to the thread that calls it. So allow caller to pass in a functor that will be executed (also in realtime context) after the clear is done. Additionally, allow for a cross-thread callback to the event loop/thread which initiated/allocated the clear event request so that it can flush its own pending loop. This part probably isn't necessary but doesn't hurt and is a useful model. The event would be placed back in the free list at the next event allocation by the calling thread anyway.
Diffstat (limited to 'libs/ardour/ardour/session_event.h')
-rw-r--r--libs/ardour/ardour/session_event.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h
index 3f7fc6c092..96145e7b29 100644
--- a/libs/ardour/ardour/session_event.h
+++ b/libs/ardour/ardour/session_event.h
@@ -111,16 +111,7 @@ public:
boost::shared_ptr<Region> region;
- SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false)
- : type (t)
- , action (a)
- , action_frame (when)
- , target_frame (where)
- , speed (spd)
- , yes_or_no (yn)
- , second_yes_or_no (yn2)
- , third_yes_or_no (yn3)
- , event_loop (0) {}
+ SessionEvent (Type t, Action a, framepos_t when, framepos_t where, double spd, bool yn = false, bool yn2 = false, bool yn3 = false);
void set_ptr (void* p) {
ptr = p;
@@ -146,6 +137,8 @@ public:
static void create_per_thread_pool (const std::string& n, uint32_t nitems);
static void init_event_pool ();
+ CrossThreadPool* event_pool() const { return own_pool; }
+
private:
static PerThreadPool* pool;
CrossThreadPool* own_pool;
@@ -161,6 +154,7 @@ public:
virtual void queue_event (SessionEvent *ev) = 0;
void clear_events (SessionEvent::Type type);
+ void clear_events (SessionEvent::Type type, boost::function<void (void)> after);
protected:
RingBuffer<SessionEvent*> pending_events;