* [FFmpeg-devel] [PATCH] lavu/thread: add support for setting thread name on *bsd and solaris
@ 2024-01-04 4:19 Brad Smith
2024-01-06 17:27 ` Michael Niedermayer
0 siblings, 1 reply; 3+ messages in thread
From: Brad Smith @ 2024-01-04 4:19 UTC (permalink / raw)
To: FFmpeg development discussions and patches
lavu/thread: add support for setting thread name on *bsd and solaris
FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses pthread_set_name_np().
Signed-off-by: Brad Smith <brad@comstyle.com>
---
configure | 10 ++++++++++
libavutil/thread.h | 14 ++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index d15cfa4703..154db61c16 100755
--- a/configure
+++ b/configure
@@ -2239,6 +2239,7 @@ HEADERS_LIST="
opencv2_core_core_c_h
OpenGL_gl3_h
poll_h
+ pthread_np_h
sys_param_h
sys_resource_h
sys_select_h
@@ -2341,6 +2342,8 @@ SYSTEM_FUNCS="
posix_memalign
prctl
pthread_cancel
+ pthread_set_name_np
+ pthread_setname_np
sched_getaffinity
SecItemImport
SetConsoleTextAttribute
@@ -6521,6 +6524,7 @@ check_headers malloc.h
check_headers mftransform.h
check_headers net/udplite.h
check_headers poll.h
+check_headers pthread_np.h
check_headers sys/param.h
check_headers sys/resource.h
check_headers sys/select.h
@@ -6689,6 +6693,12 @@ if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
if enabled pthreads; then
check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
check_func pthread_cancel $pthreads_extralibs
+ hdrs=pthread.h
+ if enabled pthread_np_h; then
+ hdrs="$hdrs pthread_np.h"
+ fi
+ check_lib pthreads "$hdrs" pthread_set_name_np -lpthread
+ check_lib pthreads "$hdrs" pthread_setname_np -lpthread
fi
fi
diff --git a/libavutil/thread.h b/libavutil/thread.h
index 2ded498c89..fa74dd2ea7 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -26,6 +26,8 @@
#if HAVE_PRCTL
#include <sys/prctl.h>
+#elif (HAVE_PTHREAD_SETNAME_NP || HAVE_PTHREAD_SET_NAME_NP) && HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
#endif
#include "error.h"
@@ -213,11 +215,19 @@ static inline int ff_thread_once(char *control, void (*routine)(void))
static inline int ff_thread_setname(const char *name)
{
+ int ret = 0;
+
#if HAVE_PRCTL
- return AVERROR(prctl(PR_SET_NAME, name));
+ ret = AVERROR(prctl(PR_SET_NAME, name));
+#elif HAVE_PTHREAD_SETNAME_NP
+ ret = AVERROR(pthread_setname_np(pthread_self(), name));
+#elif HAVE_PTHREAD_SET_NAME_NP
+ pthread_set_name_np(pthread_self(), name);
+#else
+ ret = AVERROR(ENOSYS);
#endif
- return AVERROR(ENOSYS);
+ return ret;
}
#endif /* AVUTIL_THREAD_H */
--
2.43.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavu/thread: add support for setting thread name on *bsd and solaris
2024-01-04 4:19 [FFmpeg-devel] [PATCH] lavu/thread: add support for setting thread name on *bsd and solaris Brad Smith
@ 2024-01-06 17:27 ` Michael Niedermayer
2024-01-09 4:51 ` Brad Smith
0 siblings, 1 reply; 3+ messages in thread
From: Michael Niedermayer @ 2024-01-06 17:27 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 1127 bytes --]
On Wed, Jan 03, 2024 at 11:19:56PM -0500, Brad Smith wrote:
> lavu/thread: add support for setting thread name on *bsd and solaris
>
> FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses pthread_set_name_np().
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
> configure | 10 ++++++++++
> libavutil/thread.h | 14 ++++++++++++--
> 2 files changed, 22 insertions(+), 2 deletions(-)
this breaks build on linux
./configure --enable-pthreads
ERROR: pthreads requested but not found
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Whats the most studid thing your enemy could do ? Blow himself up
Whats the most studid thing you could do ? Give up your rights and
freedom because your enemy blew himself up.
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavu/thread: add support for setting thread name on *bsd and solaris
2024-01-06 17:27 ` Michael Niedermayer
@ 2024-01-09 4:51 ` Brad Smith
0 siblings, 0 replies; 3+ messages in thread
From: Brad Smith @ 2024-01-09 4:51 UTC (permalink / raw)
To: FFmpeg development discussions and patches, Michael Niedermayer
On 2024-01-06 12:27 p.m., Michael Niedermayer wrote:
> On Wed, Jan 03, 2024 at 11:19:56PM -0500, Brad Smith wrote:
>> lavu/thread: add support for setting thread name on *bsd and solaris
>>
>> FreeBSD/DragonFly/Solaris use pthread_setname_np(). OpenBSD uses pthread_set_name_np().
>>
>> Signed-off-by: Brad Smith <brad@comstyle.com>
>> ---
>> configure | 10 ++++++++++
>> libavutil/thread.h | 14 ++++++++++++--
>> 2 files changed, 22 insertions(+), 2 deletions(-)
> this breaks build on linux
>
> ./configure --enable-pthreads
> ERROR: pthreads requested but not found
>
> If you think configure made a mistake, make sure you are using the latest
> version from Git. If the latest version fails, report the problem to the
> ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
> Include the log file "ffbuild/config.log" produced by configure as this will help
> solve the problem.
Sent a v2 diff.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-09 4:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-04 4:19 [FFmpeg-devel] [PATCH] lavu/thread: add support for setting thread name on *bsd and solaris Brad Smith
2024-01-06 17:27 ` Michael Niedermayer
2024-01-09 4:51 ` Brad Smith
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git