Files
neutrino/src/system/set_threadname.h
2014-09-15 17:13:27 +04:00

15 lines
321 B
C

#ifndef __set_threadname_h__
#define __set_threadname_h__
#include <sys/types.h>
#include <sys/prctl.h>
#include <string.h>
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