From 01eab0c7e283db9c1cfff0a26296a49128062cca Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 19 Dec 2012 13:38:24 -0500 Subject: core: working thread affinity concept into gr_blocks. Example in gnuradio-core/src/examples/mp-sched/affinity_set.py Documentation describing API in docs/doxygen/other/thread_affinity.dox --- gnuradio-core/src/lib/runtime/gr_block.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gnuradio-core/src/lib/runtime/gr_block.h') diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h index 7a70bdaf0..9906d3632 100644 --- a/gnuradio-core/src/lib/runtime/gr_block.h +++ b/gnuradio-core/src/lib/runtime/gr_block.h @@ -359,6 +359,26 @@ class GR_CORE_API gr_block : public gr_basic_block { } // ---------------------------------------------------------------------------- + // Functions to handle thread affinity + + /*! + * \brief Set the thread's affinity to processor core \p n. + * + * \param mask a vector of unsigned ints of the core numbers available to this block. + */ + void set_processor_affinity(const std::vector &mask); + + /*! + * \brief Remove processor affinity to a specific core. + */ + void unset_processor_affinity(); + + /*! + * \brief Get the current processor affinity. + */ + std::vector processor_affinity() { return d_affinity; } + + // ---------------------------------------------------------------------------- private: @@ -373,6 +393,7 @@ class GR_CORE_API gr_block : public gr_basic_block { bool d_max_noutput_items_set; // if d_max_noutput_items is valid int d_max_noutput_items; // value of max_noutput_items for this block tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream + std::vector d_affinity; // thread affinity proc. mask protected: gr_block (void){} //allows pure virtual interface sub-classes -- cgit