aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/utils/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/utils/thread.cpp')
-rw-r--r--host/lib/utils/thread.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/host/lib/utils/thread.cpp b/host/lib/utils/thread.cpp
index e5dde06b2..a2beb955b 100644
--- a/host/lib/utils/thread.cpp
+++ b/host/lib/utils/thread.cpp
@@ -167,21 +167,25 @@ static void check_priority_range(float priority){
void uhd::set_thread_name(boost::thread* thrd, const std::string& name)
{
#ifdef HAVE_PTHREAD_SETNAME
- pthread_setname_np(thrd->native_handle(), name.substr(0,16).c_str());
+ pthread_setname_np(thrd->native_handle(), name.substr(0, 16).c_str());
#endif /* HAVE_PTHREAD_SETNAME */
#ifdef HAVE_THREAD_SETNAME_DUMMY
- UHD_LOG_DEBUG("UHD", "Setting thread name is not implemented; wanted to set to " << name);
+ // Then we can't set the thread name. This function may get called
+ // before the logger starts, and thus can't log any error messages.
+ // Note that CMake will also tell the user about not being able to set
+ // thread names.
#endif /* HAVE_THREAD_SETNAME_DUMMY */
-}
+ }
-void uhd::set_thread_name(
- std::thread *thrd,
- const std::string &name
-) {
+ void uhd::set_thread_name(std::thread* thrd, const std::string& name)
+ {
#ifdef HAVE_PTHREAD_SETNAME
- pthread_setname_np(thrd->native_handle(), name.substr(0,16).c_str());
+ pthread_setname_np(thrd->native_handle(), name.substr(0, 16).c_str());
#endif /* HAVE_PTHREAD_SETNAME */
#ifdef HAVE_THREAD_SETNAME_DUMMY
- UHD_LOG_DEBUG("UHD", "Setting thread name is not implemented; wanted to set to " << name);
+ // Then we can't set the thread name. This function may get called
+ // before the logger starts, and thus can't log any error messages.
+ // Note that CMake will also tell the user about not being able to set
+ // thread names.
#endif /* HAVE_THREAD_SETNAME_DUMMY */
-}
+ }