summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime/gr_block.h
diff options
context:
space:
mode:
authorTom Rondeau2012-12-19 13:38:24 -0500
committerNicholas Corgan2013-02-06 12:35:06 -0800
commit01eab0c7e283db9c1cfff0a26296a49128062cca (patch)
tree018a9becab8641ebac71910a186d45324591e30c /gnuradio-core/src/lib/runtime/gr_block.h
parent7bc415bd2875132ce321c5913950d23e7c9ad8b1 (diff)
downloadgnuradio-01eab0c7e283db9c1cfff0a26296a49128062cca.tar.gz
gnuradio-01eab0c7e283db9c1cfff0a26296a49128062cca.tar.bz2
gnuradio-01eab0c7e283db9c1cfff0a26296a49128062cca.zip
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
Diffstat (limited to 'gnuradio-core/src/lib/runtime/gr_block.h')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h21
1 files changed, 21 insertions, 0 deletions
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<unsigned int> &mask);
+
+ /*!
+ * \brief Remove processor affinity to a specific core.
+ */
+ void unset_processor_affinity();
+
+ /*!
+ * \brief Get the current processor affinity.
+ */
+ std::vector<unsigned int> 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<unsigned int> d_affinity; // thread affinity proc. mask
protected:
gr_block (void){} //allows pure virtual interface sub-classes