diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-10-18 18:10:01 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-10-24 02:00:31 +0200 |
commit | f66e7946724a102c67bf03faaca7517d8ee2fcd9 (patch) | |
tree | 30cff9122e8d2fb359a3aaf7abc5084b6c171cca /libavutil | |
parent | 5ec9d26b2b50c535c07c0c8fb69650fbad0be892 (diff) |
lavu/thread: add an internal function for setting thread name
Linux-only for now.
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/thread.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libavutil/thread.h b/libavutil/thread.h index 7106fd0d47..2f5e7e1cb5 100644 --- a/libavutil/thread.h +++ b/libavutil/thread.h @@ -24,6 +24,12 @@ #include "config.h" +#if HAVE_PRCTL +#include <sys/prctl.h> +#endif + +#include "error.h" + #if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS #if HAVE_PTHREADS @@ -33,7 +39,6 @@ #include <stdlib.h> -#include "error.h" #include "log.h" #include "macros.h" @@ -187,4 +192,13 @@ static inline int ff_thread_once(char *control, void (*routine)(void)) #endif +static inline int ff_thread_setname(const char *name) +{ +#if HAVE_PRCTL + return AVERROR(prctl(PR_SET_NAME, name)); +#endif + + return AVERROR(ENOSYS); +} + #endif /* AVUTIL_THREAD_H */ |