diff options
author | Trumeet <yuuta@yuuta.moe> | 2021-05-16 19:23:13 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2021-05-16 19:23:13 -0700 |
commit | 7e531d78bf330bfac65cf3f208c2300b607decee (patch) | |
tree | a430b80d94661b31c7982724bf4f24667ca297b9 /threads_util.c | |
download | extmc-7e531d78bf330bfac65cf3f208c2300b607decee.tar extmc-7e531d78bf330bfac65cf3f208c2300b607decee.tar.gz extmc-7e531d78bf330bfac65cf3f208c2300b607decee.tar.bz2 extmc-7e531d78bf330bfac65cf3f208c2300b607decee.zip |
First Commit
Diffstat (limited to 'threads_util.c')
-rw-r--r-- | threads_util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/threads_util.c b/threads_util.c new file mode 100644 index 0000000..d2247a2 --- /dev/null +++ b/threads_util.c @@ -0,0 +1,15 @@ +#include "threads_util.h" + +#if defined(__linux__) +#include <sys/prctl.h> +#endif + +void thread_set_name(const char *name) +{ +#if defined(__linux__) + /* Use prctl instead to prevent using _GNU_SOURCE flag and implicit declaration */ + prctl(PR_SET_NAME, name); +#elif defined(__APPLE__) && defined(__MACH__) + pthread_setname_np(name); +#endif +} |