From 7646d2a07478db192c92f3ae772ec69c99e30aff Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 19 Jun 2013 15:17:40 +0400 Subject: [PATCH] add system/set_threadname.h from git://gitorious.org/~martii/neutrino-mp/martiis-neutrino-mp.git Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2d47ab2ecde64cef3797fc4389e0aaf3e850b0c1 Author: [CST] Focus Date: 2013-06-19 (Wed, 19 Jun 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/set_threadname.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/system/set_threadname.h 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