Thread names shortened to 15 characters to fit Posix norm.

Added get_current_thread_name()
This commit is contained in:
Vojtech Bubnik 2020-10-22 14:11:00 +02:00
parent be73962699
commit 81b6883710
3 changed files with 19 additions and 2 deletions

View file

@ -7,6 +7,8 @@
namespace Slic3r {
// Set / get thread name.
// pthread_setname_np supports maximum 15 character thread names! (16th character is the null terminator)
void set_thread_name(std::thread &thread, const char *thread_name);
inline void set_thread_name(std::thread &thread, const std::string &thread_name) { set_thread_name(thread, thread_name.c_str()); }
void set_thread_name(boost::thread &thread, const char *thread_name);
@ -14,6 +16,8 @@ inline void set_thread_name(boost::thread &thread, const std::string &thread_nam
void set_current_thread_name(const char *thread_name);
inline void set_current_thread_name(const std::string &thread_name) { set_current_thread_name(thread_name.c_str()); }
void std::string get_current_thread_name() const;
// To be called somewhere before the TBB threads are spinned for the first time, to
// give them names recognizible in the debugger.
void name_tbb_thread_pool_threads();