From 9b7a2af07fd1f5df3e517021d676805eb20bc74f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 9 Aug 2007 05:16:00 +0000 Subject: Realtime safe parallel graph execution, e.g. run with ingen -e -p 3 for 3 concurrent audio threads. git-svn-id: http://svn.drobilla.net/lad/ingen@689 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/Node.hpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/libs/engine/Node.hpp') diff --git a/src/libs/engine/Node.hpp b/src/libs/engine/Node.hpp index e6c5316b..feb9e9ef 100644 --- a/src/libs/engine/Node.hpp +++ b/src/libs/engine/Node.hpp @@ -62,6 +62,37 @@ public: virtual void deactivate() = 0; virtual bool activated() = 0; + /** Parallelism: Reset flags for start of a new cycle. + */ + virtual void reset_input_ready() = 0; + + /** Parallelism: Claim this node (to wait on its input). + * Only one thread will ever take this lock on a particular Node. + * \return true if lock was aquired, false otherwise + */ + virtual bool process_lock() = 0; + + /** Parallelism: Unclaim this node (let someone else wait on its input). + * Only a thread which successfully called process_lock may call this. + */ + virtual void process_unlock() = 0; + + /** Parallelism: Wait for signal that input is ready. + * Only a thread which successfully called process_lock may call this. + */ + virtual void wait_for_input(size_t num_providers) = 0; + + /** Parallelism: Signal that input is ready. Realtime safe. + * Calling this will wake up the thread which blocked on wait_for_input + * if there is one, and otherwise cause it to return true the next call. + * \return true if lock was aquired and input is ready, false otherwise + */ + virtual void signal_input_ready() = 0; + + /** Parallelism: Return the number of providers that have signalled. + */ + virtual unsigned n_inputs_ready() const = 0; + /** Run the node for @a nframes input/output. * * @a start and @a end are transport times: end is not redundant in the case -- cgit v1.2.1