Skip to content

Commit 772d738

Browse files
dridiwalid-git
authored andcommitted
build: Drop support for pthread_set_name_np()
We can rely on pthread_setname_np() for all the platforms we care about. The nested preprocessor conditions for pthread_setname_np are indented to improve readability. Better diff with the --ignore-all-space option.
1 parent 32935f5 commit 772d738

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

bin/varnishd/cache/cache_main.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ THR_GetWorker(void)
130130

131131
static pthread_key_t name_key;
132132

133+
#if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__APPLE__) && \
134+
!defined(__NetBSD__)
133135
static void
134136
thr_setname_generic(const char *name)
135137
{
@@ -146,22 +148,21 @@ thr_setname_generic(const char *name)
146148
//lint --e{438} Last value assigned not used
147149
PTOK(pthread_setname_np(pthread_self(), name));
148150
}
151+
#endif
149152

150153
void
151154
THR_SetName(const char *name)
152155
{
153156

154157
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)
158-
#if defined(__APPLE__)
158+
#if defined(HAVE_PTHREAD_SETNAME_NP)
159+
# if defined(__APPLE__)
159160
(void)pthread_setname_np(name);
160-
#elif defined(__NetBSD__)
161+
# elif defined(__NetBSD__)
161162
(void)pthread_setname_np(pthread_self(), "%s", (char *)(uintptr_t)name);
162-
#else
163+
# else
163164
thr_setname_generic(name);
164-
#endif
165+
# endif
165166
#endif
166167
}
167168

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ 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])
231230
AC_CHECK_FUNCS([pthread_setname_np])
232231
AC_CHECK_FUNCS([pthread_mutex_isowned_np])
233232
AC_CHECK_FUNCS([pthread_getattr_np])

0 commit comments

Comments
 (0)