cross-thread handling of SessionEvent allocation/deallocation, with widespread conseq...
[ardour.git] / libs / ardour / ardour / session_event.h
index 767c374988476b6c2fa419da9fa33b4c71f9cdc5..07c795257f554d3c2c0a2a9a439980e92d6d3549 100644 (file)
@@ -98,18 +98,17 @@ struct SessionEvent {
            return e1->before (*e2);
     }
     
-    void *operator new (size_t) {
-           return pool.alloc ();
-    }
-    
-    void operator delete (void *ptr, size_t /*size*/) {
-           pool.release (ptr);
-    }
+    void* operator new (size_t);
+    void  operator delete (void *ptr, size_t /*size*/);
     
     static const nframes_t Immediate = 0;
     
+    static void create_per_thread_pool (const std::string& n, unsigned long nitems);
+    static void init_event_pool ();
+
 private:
-    static MultiAllocSingleReleasePool pool;
+    static PerThreadPool* pool;
+    CrossThreadPool* own_pool;
 };
 
 class SessionEventManager {
@@ -120,8 +119,8 @@ class SessionEventManager {
        void add_event (nframes64_t action_frame, SessionEvent::Type type, nframes64_t target_frame = 0);
        void remove_event (nframes64_t frame, SessionEvent::Type type);
        void clear_events (SessionEvent::Type type);
-
-
+    
+        
   protected:
         RingBuffer<SessionEvent*> pending_events;
        typedef std::list<SessionEvent *> Events;