From 78cd4026c0a9b902162e94905b60a9dd44a07bb7 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 29 Mar 2013 13:12:36 -0400 Subject: core: addressing issue #529. Using vector instead of vector 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. --- gruel/src/include/gruel/thread.h | 6 +++--- gruel/src/lib/thread.cc | 40 ++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'gruel/src') 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 &mask); + GRUEL_API void thread_bind_to_processor(const std::vector &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 &mask); + GRUEL_API void thread_bind_to_processor(gr_thread_t thread, const std::vector &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 mask(1, n); + std::vector mask(1, n); thread_bind_to_processor(get_current_thread_id(), mask); } void - thread_bind_to_processor(const std::vector &mask) + thread_bind_to_processor(const std::vector &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 mask(1, n); + std::vector mask(1, n); thread_bind_to_processor(thread, mask); } void - thread_bind_to_processor(gr_thread_t thread, const std::vector &mask) + thread_bind_to_processor(gr_thread_t thread, const std::vector &mask) { //DWORD_PTR mask = (1 << n); DWORD_PTR dword_mask = 0; - std::vector _mask = mask; - std::vector::iterator itr; + std::vector _mask = mask; + std::vector::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 &mask) + thread_bind_to_processor(const std::vector &mask) { // Not implemented on OSX } void - thread_bind_to_processor(gr_thread_t thread, const std::vector &mask) + thread_bind_to_processor(gr_thread_t thread, const std::vector &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 mask(1, n); + std::vector mask(1, n); thread_bind_to_processor(get_current_thread_id(), mask); } void - thread_bind_to_processor(const std::vector &mask) + thread_bind_to_processor(const std::vector &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 mask(1, n); + std::vector mask(1, n); thread_bind_to_processor(thread, mask); } void - thread_bind_to_processor(gr_thread_t thread, const std::vector &mask) + thread_bind_to_processor(gr_thread_t thread, const std::vector &mask) { cpu_set_t set; size_t len = sizeof(cpu_set_t); - std::vector _mask = mask; - std::vector::iterator itr; + std::vector _mask = mask; + std::vector::iterator itr; CPU_ZERO(&set); for(itr = _mask.begin(); itr != _mask.end(); itr++) -- cgit