pyhelper: define set_thread_name() helper
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
This commit is contained in:
committed by
KevinOConnor
parent
d5c031bc13
commit
c78dd6a00a
@@ -10,6 +10,8 @@
|
||||
#include <stdio.h> // fprintf
|
||||
#include <string.h> // strerror
|
||||
#include <time.h> // struct timespec
|
||||
#include <linux/prctl.h> // PR_SET_NAME
|
||||
#include <sys/prctl.h> // prctl
|
||||
#include "compiler.h" // __visible
|
||||
#include "pyhelper.h" // get_monotonic
|
||||
|
||||
@@ -92,3 +94,10 @@ dump_string(char *outbuf, int outbuf_size, char *inbuf, int inbuf_size)
|
||||
*o = '\0';
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
// Set custom thread names
|
||||
int __visible
|
||||
set_thread_name(char name[16])
|
||||
{
|
||||
return prctl(PR_SET_NAME, name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user