diff options
author | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2023-01-21 16:13:27 +0000 |
---|---|---|
committer | ivan <ivan@13f79535-47bb-0310-9956-ffa450edef68> | 2023-01-21 16:13:27 +0000 |
commit | e786a4b14c92e628ae3964d27f78759446a0b456 (patch) | |
tree | 6b009aab810e5a22ec6ff0c167af99b0dd5e733e /test | |
parent | f4a4ec18a1c723f22250bc2aeb6ca58e54bb265d (diff) | |
download | libapr-e786a4b14c92e628ae3964d27f78759446a0b456.tar.gz |
Merge thread-name branch (PR 60587) [1]:
* Introduce apr_thread_name_set() and apr_thread_name_get().
[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60587
[2] https://lists.apache.org/thread/z24logzc6v8tc0p2q3375cc10qo9y5yw
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1906889 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r-- | test/testthread.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/testthread.c b/test/testthread.c index 6eb8ebc6d..72f3ddd0a 100644 --- a/test/testthread.c +++ b/test/testthread.c @@ -107,6 +107,36 @@ static void check_thread_once(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, 1, value); } +static void thread_name(abts_case *tc, void *data) +{ + apr_status_t rv; + char *name; + + rv = apr_thread_name_set("thread-1", NULL, p); + if (rv == APR_ENOTIMPL) { + ABTS_NOT_IMPL(tc, "apr_thread_name_set is not implemented.") + return ; + } + + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + + rv = apr_thread_name_get(&name, NULL, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_STR_EQUAL(tc, "thread-1", name); + + rv = apr_thread_name_set("thread-1", NULL, p); + if (rv == APR_ENOTIMPL) { + ABTS_NOT_IMPL(tc, "apr_thread_name_set is not implemented.") + return ; + } + + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + + rv = apr_thread_name_get(&name, NULL, p); + ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); + ABTS_STR_EQUAL(tc, "thread-1", name); +} + #else static void threads_not_impl(abts_case *tc, void *data) @@ -128,6 +158,7 @@ abts_suite *testthread(abts_suite *suite) abts_run_test(suite, join_threads, NULL); abts_run_test(suite, check_locks, NULL); abts_run_test(suite, check_thread_once, NULL); + abts_run_test(suite, thread_name, NULL); #endif return suite; |