summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2022-06-29 14:46:01 +0000
committerivan <ivan@13f79535-47bb-0310-9956-ffa450edef68>2022-06-29 14:46:01 +0000
commit5de1d6b83485b13d6df553ec88fc36e7dc99ca57 (patch)
treec11d1ae470b7df5fe3a5919b2c43e8e155ed4ea8
parentedc1949bb94d023754d10d6156be86494e149a2b (diff)
downloadlibapr-5de1d6b83485b13d6df553ec88fc36e7dc99ca57.tar.gz
On 'thread-name' branch: Check pthread_setname_np()/pthread_getname_np()
support. * threadproc/unix/thread.c (apr_thread_name_set, apr_thread_name_get): Return APR_ENOTIMPL if not HAVE_PTHREAD_SETNAME_NP. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902352 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--threadproc/unix/thread.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c
index e88592201..01d241751 100644
--- a/threadproc/unix/thread.c
+++ b/threadproc/unix/thread.c
@@ -286,6 +286,7 @@ APR_DECLARE(apr_status_t) apr_thread_name_set(const char *name,
apr_thread_t *thread,
apr_pool_t *pool)
{
+#if HAVE_PTHREAD_SETNAME_NP
pthread_t td;
size_t name_len;
@@ -306,12 +307,16 @@ APR_DECLARE(apr_status_t) apr_thread_name_set(const char *name,
}
return pthread_setname_np(td, name);
+#else
+ return APR_ENOTIMPL;
+#endif
}
APR_DECLARE(apr_status_t) apr_thread_name_get(char **name,
apr_thread_t *thread,
apr_pool_t *pool)
{
+#if HAVE_PTHREAD_SETNAME_NP
pthread_t td;
if (thread) {
td = *thread->td;
@@ -322,6 +327,9 @@ APR_DECLARE(apr_status_t) apr_thread_name_get(char **name,
*name = apr_pcalloc(pool, TASK_COMM_LEN);
return pthread_getname_np(td, *name, TASK_COMM_LEN);
+#else
+ return APR_ENOTIMPL;
+#endif
}
APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void)