Skip to content

Commit 32935f5

Browse files
dridiwalid-git
authored andcommitted
Revert "Deautocrap: everybody has a pthread_setname_np(2) now."
This reverts commit 41cdd27. Even though everybody has a pthread_setname_np(3), they are different and not portable by definition. The safeguards should be preserved since THR_SetName() will at least allow a panic to get the thread name.
1 parent e3aa613 commit 32935f5

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

bin/varnishd/cache/cache_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,17 @@ THR_SetName(const char *name)
152152
{
153153

154154
PTOK(pthread_setspecific(name_key, name));
155+
#if defined(HAVE_PTHREAD_SET_NAME_NP)
156+
pthread_set_name_np(pthread_self(), name);
157+
#elif defined(HAVE_PTHREAD_SETNAME_NP)
155158
#if defined(__APPLE__)
156159
(void)pthread_setname_np(name);
157160
#elif defined(__NetBSD__)
158161
(void)pthread_setname_np(pthread_self(), "%s", (char *)(uintptr_t)name);
159162
#else
160163
thr_setname_generic(name);
161164
#endif
165+
#endif
162166
}
163167

164168
const char *

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,8 @@ AC_CHECK_FUNCS([fnmatch], [], [AC_MSG_ERROR([fnmatch(3) is required])])
227227

228228
save_LIBS="${LIBS}"
229229
LIBS="${PTHREAD_LIBS}"
230+
AC_CHECK_FUNCS([pthread_set_name_np])
231+
AC_CHECK_FUNCS([pthread_setname_np])
230232
AC_CHECK_FUNCS([pthread_mutex_isowned_np])
231233
AC_CHECK_FUNCS([pthread_getattr_np])
232234
LIBS="${save_LIBS}"

0 commit comments

Comments
 (0)