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

Yuwen Chen posted 5 patches 1 month, 4 weeks ago
[PATCH v2 2/5] selftests/futex: use pthread_join to reclaim thread resources
Posted by Yuwen Chen 1 month, 4 weeks ago
When creating a thread using pthread_create, you should use
pthread_join to free its resources.

Signed-off-by: Yuwen Chen <ywen.chen@foxmail.com>
---
 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
[PATCH v2 2/5] selftests/futex: use pthread_join to reclaim thread resources
Posted by Licay 1 month, 3 weeks ago
> When creating a thread using pthread_create, you should use
> pthread_join to free its resources.
>
> Signed-off-by: Yuwen Chen <ywen.chen@foxmail.com>
Reviewed-by: Licay <licayy@foxmail.com>
> ---
>  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
>