diff options
author | Tom Rondeau | 2013-03-29 13:12:36 -0400 |
---|---|---|
committer | Johnathan Corgan | 2013-03-29 10:55:06 -0700 |
commit | 78cd4026c0a9b902162e94905b60a9dd44a07bb7 (patch) | |
tree | e723d38d7b19b13d3c713868d755f2c48e84c726 /gruel/src | |
parent | 91714eaa1fd33f4f801a9a8dedbd6832c01b1204 (diff) | |
download | gnuradio-78cd4026c0a9b902162e94905b60a9dd44a07bb7.tar.gz gnuradio-78cd4026c0a9b902162e94905b60a9dd44a07bb7.tar.bz2 gnuradio-78cd4026c0a9b902162e94905b60a9dd44a07bb7.zip |
core: addressing issue #529. Using vector<int> instead of vector<unsigned int> for affinity mask vector.
This is wrong as the mask should be unsigned, but necessary for SWIG to work cleanly on both 32-bit and 64-bit platforms.
Diffstat (limited to 'gruel/src')
-rw-r--r-- | gruel/src/include/gruel/thread.h | 6 | ||||
-rw-r--r-- | gruel/src/lib/thread.cc | 40 |
2 files changed, 23 insertions, 23 deletions
diff --git a/gruel/src/include/gruel/thread.h b/gruel/src/include/gruel/thread.h index 60832675c..10c6c38cc 100644 --- a/gruel/src/include/gruel/thread.h +++ b/gruel/src/include/gruel/thread.h @@ -75,7 +75,7 @@ namespace gruel { * support in this way since 10.5 is not what we want or can use in * this fashion). */ - GRUEL_API void thread_bind_to_processor(const std::vector<unsigned int> &mask); + GRUEL_API void thread_bind_to_processor(const std::vector<int> &mask); /*! \brief Convineince function to bind the current thread to a single core. * @@ -87,7 +87,7 @@ namespace gruel { * support in this way since 10.5 is not what we want or can use in * this fashion). */ - GRUEL_API void thread_bind_to_processor(unsigned int n); + GRUEL_API void thread_bind_to_processor(int n); /*! \brief Bind a thread to a set of cores. * @@ -101,7 +101,7 @@ namespace gruel { * support in this way since 10.5 is not what we want or can use in * this fashion). */ - GRUEL_API void thread_bind_to_processor(gr_thread_t thread, const std::vector<unsigned int> &mask); + GRUEL_API void thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask); /*! \brief Convineince function to bind the a thread to a single core. diff --git a/gruel/src/lib/thread.cc b/gruel/src/lib/thread.cc index 8ebe822fb..a5116b687 100644 --- a/gruel/src/lib/thread.cc +++ b/gruel/src/lib/thread.cc @@ -38,33 +38,33 @@ namespace gruel { } void - thread_bind_to_processor(unsigned int n) + thread_bind_to_processor(int n) { - std::vector<unsigned int> mask(1, n); + std::vector<int> mask(1, n); thread_bind_to_processor(get_current_thread_id(), mask); } void - thread_bind_to_processor(const std::vector<unsigned int> &mask) + thread_bind_to_processor(const std::vector<int> &mask) { thread_bind_to_processor(get_current_thread_id(), mask); } void - thread_bind_to_processor(gr_thread_t thread, unsigned int n) + thread_bind_to_processor(gr_thread_t thread, int n) { - std::vector<unsigned int> mask(1, n); + std::vector<int> mask(1, n); thread_bind_to_processor(thread, mask); } void - thread_bind_to_processor(gr_thread_t thread, const std::vector<unsigned int> &mask) + thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask) { //DWORD_PTR mask = (1 << n); DWORD_PTR dword_mask = 0; - std::vector<unsigned int> _mask = mask; - std::vector<unsigned int>::iterator itr; + std::vector<int> _mask = mask; + std::vector<int>::iterator itr; for(itr = _mask.begin(); itr != _mask.end(); itr++) dword_mask |= (1 << (*itr)); @@ -106,25 +106,25 @@ namespace gruel { } void - thread_bind_to_processor(unsigned int n) + thread_bind_to_processor(int n) { // Not implemented on OSX } void - thread_bind_to_processor(gr_thread_t thread, unsigned int n) + thread_bind_to_processor(gr_thread_t thread, int n) { // Not implemented on OSX } void - thread_bind_to_processor(const std::vector<unsigned int> &mask) + thread_bind_to_processor(const std::vector<int> &mask) { // Not implemented on OSX } void - thread_bind_to_processor(gr_thread_t thread, const std::vector<unsigned int> &mask) + thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask) { // Not implemented on OSX } @@ -157,32 +157,32 @@ namespace gruel { } void - thread_bind_to_processor(unsigned int n) + thread_bind_to_processor(int n) { - std::vector<unsigned int> mask(1, n); + std::vector<int> mask(1, n); thread_bind_to_processor(get_current_thread_id(), mask); } void - thread_bind_to_processor(const std::vector<unsigned int> &mask) + thread_bind_to_processor(const std::vector<int> &mask) { thread_bind_to_processor(get_current_thread_id(), mask); } void - thread_bind_to_processor(gr_thread_t thread, unsigned int n) + thread_bind_to_processor(gr_thread_t thread, int n) { - std::vector<unsigned int> mask(1, n); + std::vector<int> mask(1, n); thread_bind_to_processor(thread, mask); } void - thread_bind_to_processor(gr_thread_t thread, const std::vector<unsigned int> &mask) + thread_bind_to_processor(gr_thread_t thread, const std::vector<int> &mask) { cpu_set_t set; size_t len = sizeof(cpu_set_t); - std::vector<unsigned int> _mask = mask; - std::vector<unsigned int>::iterator itr; + std::vector<int> _mask = mask; + std::vector<int>::iterator itr; CPU_ZERO(&set); for(itr = _mask.begin(); itr != _mask.end(); itr++) |