[PATCH v2 2/5] selftests/futex: use pthread_join to reclaim thread resources

From: Licay
Date: Tue Dec 16 2025 - 04:05:11 EST


> When creating a thread using pthread_create, you should use
> pthread_join to free its resources.
>
> Signed-off-by: Yuwen Chen <ywen.chen@xxxxxxxxxxx>
Reviewed-by: Licay <licayy@xxxxxxxxxxx>
> ---
> tools/testing/selftests/futex/functional/futex_requeue.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/selftests/futex/functional/futex_requeue.c b/tools/testing/selftests/futex/functional/futex_requeue.c
> index 1807465de2144..7a22458c7fc96 100644
> --- a/tools/testing/selftests/futex/functional/futex_requeue.c
> +++ b/tools/testing/selftests/futex/functional/futex_requeue.c
> @@ -62,6 +62,8 @@ TEST(requeue_single)
> } else {
> ksft_test_result_pass("futex_requeue simple succeeds\n");
> }
> +
> + pthread_join(waiter, NULL);
> }
>
> TEST(requeue_multiple)
> @@ -101,6 +103,9 @@ TEST(requeue_multiple)
> } else {
> ksft_test_result_pass("futex_requeue many succeeds\n");
> }
> +
> + for (i = 0; i < 10; i++)
> + pthread_join(waiter[i], NULL);
> }
>
> TEST_HARNESS_MAIN
> --
> 2.34.1
>