#include <cassert>
#include <pthread.h>
-#include <semaphore.h>
-#include <ardour/types.h>
-#include <ardour/session_handle.h>
+#include "pbd/semutils.h"
+
+#include "ardour/types.h"
+#include "ardour/session_handle.h"
namespace ARDOUR
{
void helper_thread();
void main_thread();
- int silent_process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
- bool can_record, bool rec_monitors_input, bool& need_butler);
+ int silent_process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ bool can_record, bool rec_monitors_input, bool& need_butler);
- int process_routes (nframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
- bool can_record, bool rec_monitors_input, bool& need_butler);
+ int process_routes (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick,
+ bool can_record, bool rec_monitors_input, bool& need_butler);
- int routes_no_roll (nframes_t nframes, framepos_t start_frame, framepos_t end_frame,
- bool non_rt_pending, bool can_record, int declick);
+ int routes_no_roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame,
+ bool non_rt_pending, bool can_record, int declick);
void process_one_route (Route * route);
+ void clear_other_chain ();
+
protected:
virtual void session_going_away ();
private:
- std::list<Glib::Thread *> _thread_list;
+ std::list<pthread_t> _thread_list;
volatile bool _quit_threads;
node_list_t _nodes_rt[2];
std::vector<GraphNode *> _trigger_queue;
pthread_mutex_t _trigger_mutex;
+ PBD::ProcessSemaphore _execution_sem;
- sem_t _execution_sem;
-
- sem_t _callback_start_sem;
- sem_t _callback_done_sem;
+ PBD::ProcessSemaphore _callback_start_sem;
+ PBD::ProcessSemaphore _callback_done_sem;
+ PBD::ProcessSemaphore _cleanup_sem;
volatile gint _execution_tokens;
volatile gint _finished_refcount;
bool _graph_empty;
// chain swapping
- pthread_mutex_t _swap_mutex;
+ Glib::Mutex _swap_mutex;
+ Glib::Cond _cleanup_cond;
volatile int _current_chain;
volatile int _pending_chain;
volatile int _setup_chain;
// parameter caches.
- nframes_t _process_nframes;
+ pframes_t _process_nframes;
framepos_t _process_start_frame;
framepos_t _process_end_frame;
bool _process_can_record;