diff --git a/src/system/set_threadname.h b/src/system/set_threadname.h new file mode 100644 index 000000000..587b8c4f9 --- /dev/null +++ b/src/system/set_threadname.h @@ -0,0 +1,14 @@ +#ifndef __set_threadname_h__ +#define __set_threadname_h__ +#include +#include +#include + +inline void set_threadname(const char *name) +{ + char threadname[17]; + strncpy(threadname, name, sizeof(threadname)); + threadname[16] = 0; + prctl (PR_SET_NAME, (unsigned long)&threadname); +} +#endif