diff options
author | Ivan Zhakov <ivan@apache.org> | 2022-06-27 23:13:52 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2022-06-27 23:13:52 +0000 |
commit | 7791a5b5497b7dad6f500e2db2df4da1d35cacaf (patch) | |
tree | 068fa7aef0a464175de8bfbb102f046b8ec5f5c3 /include | |
parent | 7bcf46ab762c90550e499ae1a5a4134ea3d27a8c (diff) | |
download | apr-7791a5b5497b7dad6f500e2db2df4da1d35cacaf.tar.gz |
On 'thread-name' branch: Add apr_thread_name_get() and apr_thread_name_set()
API to get/set thread name.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902297 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/apr_thread_proc.h | 23 | ||||
-rw-r--r-- | include/arch/win32/apr_arch_misc.h | 10 |
2 files changed, 33 insertions, 0 deletions
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h index 952c76d2d..39dc25811 100644 --- a/include/apr_thread_proc.h +++ b/include/apr_thread_proc.h @@ -331,6 +331,29 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd); /** + * Get name of thread + * @param name The variable where is will be stored name of thread. + * @param thread The thread that name required to get. + * Current thread will be used if @param thread is NULL. + * @param cont The pool to use + */ +APR_DECLARE(apr_status_t) apr_thread_name_get(char **name, + apr_thread_t *thread, + apr_pool_t *pool); + +/** + * Set name of thread + * @param name The name of thread must be setted. If name is to long, then + * name stripped to max length supported by operation system. + * @param thread The thread that name will be changed. + * Current thread will be used if @param thread is NULL. + * @param cont The pool to use for temporary allocations + */ +APR_DECLARE(apr_status_t) apr_thread_name_set(const char *name, + apr_thread_t *thread, + apr_pool_t *pool); + +/** * force the current thread to yield the processor */ APR_DECLARE(void) apr_thread_yield(void); diff --git a/include/arch/win32/apr_arch_misc.h b/include/arch/win32/apr_arch_misc.h index 057f4adfa..53ef2ea1b 100644 --- a/include/arch/win32/apr_arch_misc.h +++ b/include/arch/win32/apr_arch_misc.h @@ -289,4 +289,14 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_API_MS_WIN_DOWNLEVEL_SHELL32_L1_1_0, LPWSTR *, (LPCWSTR lpCmdLine, int *pNumArgs), (lpCmdLine, pNumArgs)); +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, GetThreadDescription, 0, ( + HANDLE hThread, + PWSTR *ppszThreadDescription), + (hThread, ppszThreadDescription)); + +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, SetThreadDescription, 0, ( + HANDLE hThread, + PCWSTR lpThreadDescription), + (hThread, lpThreadDescription)); + #endif /* ! MISC_H */ |