summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/isc/pthreads/thread.c
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2019-12-17 01:46:30 +0000
committersthen <sthen@openbsd.org>2019-12-17 01:46:30 +0000
commit3ef32adf69b1fed9e0363dd1f2116627f09e6af3 (patch)
tree4d9d566691647dad37619d7bd9d1c7114f554bbe /usr.sbin/bind/lib/isc/pthreads/thread.c
parentAdd support for NCT6775F, NCT5104D, NCT6779D, NCT679[1235]D sensors. (diff)
downloadwireguard-openbsd-3ef32adf69b1fed9e0363dd1f2116627f09e6af3.tar.xz
wireguard-openbsd-3ef32adf69b1fed9e0363dd1f2116627f09e6af3.zip
update to 9.10.8-P1, last isc-licensed release
Diffstat (limited to 'usr.sbin/bind/lib/isc/pthreads/thread.c')
-rw-r--r--usr.sbin/bind/lib/isc/pthreads/thread.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/usr.sbin/bind/lib/isc/pthreads/thread.c b/usr.sbin/bind/lib/isc/pthreads/thread.c
index 7a2a9f396d6..2c5dea766c5 100644
--- a/usr.sbin/bind/lib/isc/pthreads/thread.c
+++ b/usr.sbin/bind/lib/isc/pthreads/thread.c
@@ -1,6 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2007, 2013 Internet Systems Consortium, Inc. ("ISC")
- * Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: thread.c,v 1.6 2019/12/16 16:16:27 deraadt Exp $ */
+/* $Id: thread.c,v 1.7 2019/12/17 01:46:36 sthen Exp $ */
/*! \file */
@@ -37,7 +36,10 @@ isc_thread_create(isc_threadfunc_t func, isc_threadarg_t arg,
isc_thread_t *thread)
{
pthread_attr_t attr;
+#if defined(HAVE_PTHREAD_ATTR_GETSTACKSIZE) && \
+ defined(HAVE_PTHREAD_ATTR_SETSTACKSIZE)
size_t stacksize;
+#endif
int ret;
pthread_attr_init(&attr);
@@ -80,6 +82,22 @@ isc_thread_setconcurrency(unsigned int level) {
}
void
+isc_thread_setname(isc_thread_t thread, const char *name) {
+#if defined(HAVE_PTHREAD_SETNAME_NP) && defined(_GNU_SOURCE)
+ /*
+ * macOS has pthread_setname_np but only works on the
+ * current thread so it's not used here
+ */
+ (void)pthread_setname_np(thread, name);
+#elif defined(HAVE_PTHREAD_SET_NAME_NP)
+ (void)pthread_set_name_np(thread, name);
+#else
+ UNUSED(thread);
+ UNUSED(name);
+#endif
+}
+
+void
isc_thread_yield(void) {
#if defined(HAVE_SCHED_YIELD)
sched_yield();