Skip to content

Commit

Permalink
Use correct function for setting thread name.
Browse files Browse the repository at this point in the history
Correct typo that checked for pthread_set_name_np() instead of
pthread_setname_np().

Thread names should now be visible in /proc/CHILDPID/tasks/*/comm on
Linux systems.
  • Loading branch information
Lasse Karstensen committed Nov 26, 2015
1 parent 77fec1b commit 83aa540
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bin/varnishd/cache/cache_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ THR_SetName(const char *name)
{

AZ(pthread_setspecific(name_key, name));
#ifdef HAVE_PTHREAD_SET_NAME_NP
pthread_set_name_np(pthread_self(), name);
#ifdef HAVE_PTHREAD_SETNAME_NP
pthread_setname_np(pthread_self(), name);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion config.phk
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ exit 0
# HAVE_DLADDR +
# HAVE_KQUEUE +
# HAVE_NANOSLEEP +
# HAVE_PTHREAD_SET_NAME_NP +
# HAVE_PTHREAD_SETNAME_NP +
# HAVE_SETPROCTITLE +
# HAVE_SRANDOMDEV +
# HAVE_TCP_KEEP +
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ AC_CHECK_FUNCS([fallocate])

save_LIBS="${LIBS}"
LIBS="${PTHREAD_LIBS}"
AC_CHECK_FUNCS([pthread_set_name_np])
AC_CHECK_FUNCS([pthread_setname_np])
AC_CHECK_FUNCS([pthread_mutex_isowned_np])
AC_CHECK_FUNCS([pthread_timedjoin_np])
LIBS="${save_LIBS}"
Expand Down

0 comments on commit 83aa540

Please sign in to comment.