[vlc-devel] [PATCH v3 1/4] thread: add a function to give names to threads
Alexandre Janniaux
ajanni at videolabs.io
Thu Nov 12 11:55:10 CET 2020
Hi,
On Thu, Nov 12, 2020 at 11:17:51AM +0100, Steve Lhomme wrote:
> On 2020-11-12 9:45, Rémi Denis-Courmont wrote:
> > Le torstaina 12. marraskuuta 2020, 8.23.33 EET Steve Lhomme a écrit :
> > > > This is not Android-specific and should be in linux/thread.c.
> > >
> > > It is.
> >
> > No it is not. That nonportable POSIX thread extension function also exists on
> > desktop Linux and even some other OSes.
>
> But that's not what we use for Linux, nor other platforms. And I prefer to
> use the variants already used in dav1d that are known to work that just
> trying to guess which system has what hack.
Documentation of prctl mention:
PR_SET_NAME (since Linux 2.6.9)
Set the name of the calling thread, using the value in the location pointed to by (char *) arg2. The name can be up to 16 bytes long, including the terminating null byte.
(If the length of the string, including the terminating null byte, exceeds 16 bytes, the string is silently truncated.) This is the same attribute that can be set via
pthread_setname_np(3) and retrieved using pthread_getname_np(3). The attribute is likewise accessible via /proc/self/task/[tid]/comm (see proc(5)), where [tid] is the
thread ID of the calling thread, as returned by gettid(2).
So using pthread_setname_np for every posix systems looks
like less code and different function to worry about.
Regards,
--
Alexandre Janniaux
Videolabs
More information about the vlc-devel
mailing list