Skip to content

Instantly share code, notes, and snippets.

@sapier
Created January 24, 2014 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sapier/8602068 to your computer and use it in GitHub Desktop.
Save sapier/8602068 to your computer and use it in GitHub Desktop.
diff --git a/src/log.cpp b/src/log.cpp
index 97f25cc..630c142 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -57,13 +57,15 @@ void log_remove_output(ILogOutput *out)
log_outputs[i].erase(it);
}
}
-
+#include <sys/prctl.h>
void log_register_thread(const std::string &name)
{
threadid_t id = get_current_thread_id();
log_threadnamemutex.Lock();
log_threadnames[id] = name;
log_threadnamemutex.Unlock();
+
+ prctl(PR_SET_NAME,name.c_str(),0,0,0);
}
void log_deregister_thread()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment