summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-06-29 14:46:01 +0000
committerIvan Zhakov <ivan@apache.org>2022-06-29 14:46:01 +0000
commit9aab4125498301f37c769e761cdababdab196b63 (patch)
treec11d1ae470b7df5fe3a5919b2c43e8e155ed4ea8 /threadproc
parent64e1d82f51f1d8a10a4425a4f9531d8eb7bfff43 (diff)
downloadapr-9aab4125498301f37c769e761cdababdab196b63.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
Diffstat (limited to 'threadproc')
-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)