pthread_setname_np() for debugging

MO
Martin Oberhuber
Wed, May 2, 2018 5:25 PM

This time with attachment :)

Dear pjsip list When debugging our multi-threaded Linux application that
links against PJSIP, it is quite annoying that the PJSIP threads don't
declare themselves. The threads inherit the application name, which makes
it difficult finding our own application's main thread.

Attached patch improves this by using pthread_setname_np() from
inside lib/pj/os_core_unix.c : pj_thread_create().

Could this patch be considered for inclusion in the next PJSIP release?

Many thanks,
Martin

--

Martin Oberhuber https://at.linkedin.com/in/martin-oberhuber-25b43a8
| Software Architect, Project Lead & Consultant | Austria

This time with attachment :) Dear pjsip list When debugging our multi-threaded Linux application that links against PJSIP, it is quite annoying that the PJSIP threads don't declare themselves. The threads inherit the application name, which makes it difficult finding our own application's main thread. Attached patch improves this by using pthread_setname_np() from inside lib/pj/os_core_unix.c : pj_thread_create(). Could this patch be considered for inclusion in the next PJSIP release? Many thanks, Martin -- Martin Oberhuber <https://at.linkedin.com/in/martin-oberhuber-25b43a8> | Software Architect, Project Lead & Consultant | Austria
MO
Martin Oberhuber
Tue, Jun 12, 2018 6:49 AM

Hello pjsip,

any suggestion on my proposed patch?

Thanks,
Martin

On 2 May 2018, at 19:25, Martin Oberhuber mober.at@gmail.com wrote:

This time with attachment :)
Dear pjsip list

When debugging our multi-threaded Linux application that links
against PJSIP, it is quite annoying that the PJSIP threads don't
declare themselves. The threads inherit the application name,
which makes it difficult finding our own application's main thread.
Attached patch improves this by using pthread_setname_np() from
inside lib/pj/os_core_unix.c : pj_thread_create().
Could this patch be considered for inclusion in the next PJSIP release?
Many thanks,
Martin

Martin Oberhuber https://at.linkedin.com/in/martin-oberhuber-25b43a8 | Software Architect, Project Lead & Consultant | Austria
<pjproject-2.7.1-pthread_setname.patch>

Hello pjsip, any suggestion on my proposed patch? Thanks, Martin > On 2 May 2018, at 19:25, Martin Oberhuber <mober.at@gmail.com> wrote: > > This time with attachment :) > Dear pjsip list > > When debugging our multi-threaded Linux application that links > against PJSIP, it is quite annoying that the PJSIP threads don't > declare themselves. The threads inherit the application name, > which makes it difficult finding our own application's main thread. > Attached patch improves this by using pthread_setname_np() from > inside lib/pj/os_core_unix.c : pj_thread_create(). > Could this patch be considered for inclusion in the next PJSIP release? > Many thanks, > Martin > -- > Martin Oberhuber <https://at.linkedin.com/in/martin-oberhuber-25b43a8> | Software Architect, Project Lead & Consultant | Austria > <pjproject-2.7.1-pthread_setname.patch>
MO
Martin Oberhuber
Tue, Jul 3, 2018 10:00 AM

Hello PJSIP,

My patch from 2-May solves a real annoyance for us. And I don't think that
pthread_setname_np() could have any negative impact.

I'm attaching the patch again for reference. I can rebase the patch to latest
if desired, or move the pthread_setname_np() to a different location.
But first of all a comment would be appreciated.

Thanks!
Martin

On 2 May 2018, at 19:25, Martin Oberhuber mober.at@gmail.com wrote:

This time with attachment :)
Dear pjsip list

When debugging our multi-threaded Linux application that links
against PJSIP, it is quite annoying that the PJSIP threads don't
declare themselves. The threads inherit the application name,
which makes it difficult finding our own application's main thread.
Attached patch improves this by using pthread_setname_np() from
inside lib/pj/os_core_unix.c : pj_thread_create().
Could this patch be considered for inclusion in the next PJSIP release?
Many thanks,
Martin

Martin Oberhuber https://at.linkedin.com/in/martin-oberhuber-25b43a8 | Software Architect, Project Lead & Consultant | Austria

Hello PJSIP, My patch from 2-May solves a real annoyance for us. And I don't think that pthread_setname_np() could have any negative impact. I'm attaching the patch again for reference. I can rebase the patch to latest if desired, or move the pthread_setname_np() to a different location. But first of all a comment would be appreciated. Thanks! Martin > On 2 May 2018, at 19:25, Martin Oberhuber <mober.at@gmail.com> wrote: > > This time with attachment :) > Dear pjsip list > > When debugging our multi-threaded Linux application that links > against PJSIP, it is quite annoying that the PJSIP threads don't > declare themselves. The threads inherit the application name, > which makes it difficult finding our own application's main thread. > Attached patch improves this by using pthread_setname_np() from > inside lib/pj/os_core_unix.c : pj_thread_create(). > Could this patch be considered for inclusion in the next PJSIP release? > Many thanks, > Martin > -- > Martin Oberhuber <https://at.linkedin.com/in/martin-oberhuber-25b43a8> | Software Architect, Project Lead & Consultant | Austria >
M
Ming
Wed, Jul 4, 2018 1:10 AM

Hi Martin,

I believe this can only work if you use glibc 2.12 or above. Also,
this function is marked as "nonstandard GNU extensions".
https://linux.die.net/man/3/pthread_setname_np

which means that there may be potential compatibility issue on older
systems or systems that do not implement this.

Regards,
Ming

On Tue, Jul 3, 2018 at 6:00 PM, Martin Oberhuber mober.at@gmail.com wrote:

Hello PJSIP,

My patch from 2-May solves a real annoyance for us. And I don't think that
pthread_setname_np() could have any negative impact.

I'm attaching the patch again for reference. I can rebase the patch to
latest
if desired, or move the pthread_setname_np() to a different location.
But first of all a comment would be appreciated.

Thanks!
Martin

On 2 May 2018, at 19:25, Martin Oberhuber mober.at@gmail.com wrote:

This time with attachment :)

Dear pjsip list

When debugging our multi-threaded Linux application that links
against PJSIP, it is quite annoying that the PJSIP threads don't
declare themselves. The threads inherit the application name,
which makes it difficult finding our own application's main thread.

Attached patch improves this by using pthread_setname_np() from
inside lib/pj/os_core_unix.c : pj_thread_create().

Could this patch be considered for inclusion in the next PJSIP release?

Many thanks,
Martin

--

Martin Oberhuber | Software Architect, Project Lead & Consultant | Austria


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Martin, I believe this can only work if you use glibc 2.12 or above. Also, this function is marked as "nonstandard GNU extensions". https://linux.die.net/man/3/pthread_setname_np which means that there may be potential compatibility issue on older systems or systems that do not implement this. Regards, Ming On Tue, Jul 3, 2018 at 6:00 PM, Martin Oberhuber <mober.at@gmail.com> wrote: > Hello PJSIP, > > My patch from 2-May solves a real annoyance for us. And I don't think that > pthread_setname_np() could have any negative impact. > > I'm attaching the patch again for reference. I can rebase the patch to > latest > if desired, or move the pthread_setname_np() to a different location. > But first of all a comment would be appreciated. > > Thanks! > Martin > > > > On 2 May 2018, at 19:25, Martin Oberhuber <mober.at@gmail.com> wrote: > > This time with attachment :) > > Dear pjsip list > > When debugging our multi-threaded Linux application that links > against PJSIP, it is quite annoying that the PJSIP threads don't > declare themselves. The threads inherit the application name, > which makes it difficult finding our own application's main thread. > > Attached patch improves this by using pthread_setname_np() from > inside lib/pj/os_core_unix.c : pj_thread_create(). > > Could this patch be considered for inclusion in the next PJSIP release? > > Many thanks, > Martin > > -- > > Martin Oberhuber | Software Architect, Project Lead & Consultant | Austria > > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >