diff options
author | Josh Blum | 2013-05-05 17:38:32 -0700 |
---|---|---|
committer | Josh Blum | 2013-05-05 17:38:32 -0700 |
commit | 9e486336d789addc2b9ad215485dc01751613e05 (patch) | |
tree | 7d4dfcdb0dcb2e56569ea758f63afd627df7ecaf /include | |
parent | 16b78fc6828e7a42cdf28fb2d22d288c94f62649 (diff) | |
parent | 1b84453cc51b07eb9106bcd6731a321ff1924d74 (diff) | |
download | sandhi-9e486336d789addc2b9ad215485dc01751613e05.tar.gz sandhi-9e486336d789addc2b9ad215485dc01751613e05.tar.bz2 sandhi-9e486336d789addc2b9ad215485dc01751613e05.zip |
Merge branch 'master' into theron6_work
Diffstat (limited to 'include')
-rw-r--r-- | include/gras/block.hpp | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/include/gras/block.hpp b/include/gras/block.hpp index 8cb5f95..85a6ecc 100644 --- a/include/gras/block.hpp +++ b/include/gras/block.hpp @@ -76,6 +76,22 @@ struct GRAS_API InputPortConfig * Default = 0. */ size_t preload_items; + + /*! + * Force this block done when input port is done. + * When the upstream feeding this port declares done, + * this block will mark done once upstream notifies. + * The primary usage is to modify the done logic + * for the purposes of unit test confiruability. + * + * If the force done option is false, the block will + * not mark done when this port's upstream is done. + * However, this block will mark done when all + * input ports are done, reguardless of this setting. + * + * Default = true. + */ + bool force_done; }; //! Configuration parameters for an output port @@ -186,15 +202,22 @@ struct GRAS_API Block : Element */ virtual void propagate_tags(const size_t which_input, const TagIter &iter); + /*! + * Send a tag to the given input port on this block. + * This is a thread-safe way for external scheduler + * entities to post tags into the input of a block. + * \param which_input an input port on this block + * \param tag the tag to post to the input port + */ + void post_input_tag(const size_t which_input, const Tag &tag); /******************************************************************* * Deal with message passing ******************************************************************/ /*! - * Post output message convenience routine. * Send a message to the downstream on the given output port. - * The underlying implementation is a tag with an offset of 0. + * Messages are naturally asynchronous to stream and tag data. * * \param which_output the index of the output port * \param msg the message object to pass downstream @@ -214,6 +237,15 @@ struct GRAS_API Block : Element */ PMCC pop_input_msg(const size_t which_input); + /*! + * Send a message to the given input port on this block. + * This is a thread-safe way for external scheduler + * entities to post messages into the input of a block. + * \param which_input an input port on this block + * \param msg the message to post to the input port + */ + void post_input_msg(const size_t which_input, const PMCC &tag); + /******************************************************************* * The property interface: * Provides polymorphic, thread-safe access to block properties. @@ -356,6 +388,10 @@ struct GRAS_API Block : Element */ void mark_done(void); + /******************************************************************* + * Direct buffer access API + ******************************************************************/ + /*! * Get access to the underlying reference counted input buffer. * This is the same buffer pointed to by input_items[which]. @@ -407,6 +443,20 @@ struct GRAS_API Block : Element void post_output_buffer(const size_t which_output, const SBuffer &buffer); /*! + * Post a buffer to the given input port on this block. + * This is a thread-safe way for external scheduler + * entities to post buffers into the input of a block. + * + * \param which_input an input port on this block + * \param buffer the buffer to post to the input port + */ + void post_input_buffer(const size_t which_input, const SBuffer &buffer); + + /******************************************************************* + * Scheduler notification API + ******************************************************************/ + + /*! * Overload notify_active to get called when block becomes active. * This will be called when the TopBlock start/run API call executes. * The default implementation of notify_active is a NOP. @@ -427,6 +477,10 @@ struct GRAS_API Block : Element */ virtual void notify_topology(const size_t num_inputs, const size_t num_outputs); + /******************************************************************* + * routines related to affinity and allocation + ******************************************************************/ + /*! * Set if the work call should be interruptible by stop(). * Some work implementations block with the expectation of @@ -436,10 +490,6 @@ struct GRAS_API Block : Element */ void set_interruptible_work(const bool enb); - /******************************************************************* - * routines related to affinity and allocation - ******************************************************************/ - /*! * Set the node affinity of this block. * This call affects how output buffers are allocated. |