diff options
Diffstat (limited to 'host/include/uhd/utils/thread.hpp')
-rw-r--r-- | host/include/uhd/utils/thread.hpp | 81 |
1 files changed, 37 insertions, 44 deletions
diff --git a/host/include/uhd/utils/thread.hpp b/host/include/uhd/utils/thread.hpp index 5251d341e..c7358040e 100644 --- a/host/include/uhd/utils/thread.hpp +++ b/host/include/uhd/utils/thread.hpp @@ -12,49 +12,42 @@ #include <boost/thread/thread.hpp> #include <string> -namespace uhd{ - - static const float default_thread_priority = float(0.5); - - /*! - * Set the scheduling priority on the current thread. - * - * A new thread or calling process should make this call - * with the defaults this to enable realtime scheduling. - * - * A priority of zero corresponds to normal priority. - * Positive priority values are higher than normal. - * Negative priority values are lower than normal. - * - * \param priority a value between -1 and 1 - * \param realtime true to use realtime mode - * \throw exception on set priority failure - */ - UHD_API void set_thread_priority( - float priority = default_thread_priority, - bool realtime = true - ); - - /*! - * Set the scheduling priority on the current thread. - * Same as set_thread_priority but does not throw on failure. - * \return true on success, false on failure - */ - UHD_API bool set_thread_priority_safe( - float priority = default_thread_priority, - bool realtime = true - ); - - /*! - * Set the thread name on the given boost thread. - * \param thread pointer to a boost thread - * \param name thread name with maximum length of 16 characters - */ - UHD_API void set_thread_name( - boost::thread *thread, - const std::string &name - ); - -} //namespace uhd +namespace uhd { + +static const float default_thread_priority = float(0.5); + +/*! + * Set the scheduling priority on the current thread. + * + * A new thread or calling process should make this call + * with the defaults this to enable realtime scheduling. + * + * A priority of zero corresponds to normal priority. + * Positive priority values are higher than normal. + * Negative priority values are lower than normal. + * + * \param priority a value between -1 and 1 + * \param realtime true to use realtime mode + * \throw exception on set priority failure + */ +UHD_API void set_thread_priority( + float priority = default_thread_priority, bool realtime = true); + +/*! + * Set the scheduling priority on the current thread. + * Same as set_thread_priority but does not throw on failure. + * \return true on success, false on failure + */ +UHD_API bool set_thread_priority_safe( + float priority = default_thread_priority, bool realtime = true); + +/*! + * Set the thread name on the given boost thread. + * \param thread pointer to a boost thread + * \param name thread name with maximum length of 16 characters + */ +UHD_API void set_thread_name(boost::thread* thread, const std::string& name); + +} // namespace uhd #endif /* INCLUDED_UHD_UTILS_THREAD_HPP */ |