[Piglit] [PATCH] glx-multithread-clearbuffer: Check pthread_join return value.

Marek Olšák maraeo at gmail.com
Tue Jul 25 16:13:20 UTC 2017


If you do what Brian said:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Tue, Jul 25, 2017 at 2:42 AM, Vinson Lee <vlee at freedesktop.org> wrote:
> Fix Coverity unchecked return value defect.
>
> CID: 1415101
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/glx/glx-multithread-clearbuffer.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/tests/glx/glx-multithread-clearbuffer.c b/tests/glx/glx-multithread-clearbuffer.c
> index 577fde842435..da301089f2a6 100644
> --- a/tests/glx/glx-multithread-clearbuffer.c
> +++ b/tests/glx/glx-multithread-clearbuffer.c
> @@ -82,6 +82,7 @@ main(int argc, char **argv)
>  {
>         /* Need at least 16 contexts to congest the thread queue. */
>         pthread_t thread[16];
> +       bool pass = true;
>
>         XInitThreads();
>
> @@ -90,11 +91,15 @@ main(int argc, char **argv)
>         for (int i = 0; i < ARRAY_SIZE(thread); i++)
>                 pthread_create(&thread[i], NULL, thread_func, NULL);
>
> -       for (int i = 0; i < ARRAY_SIZE(thread); i++)
> -               pthread_join(thread[i], NULL);
> +       for (int i = 0; i < ARRAY_SIZE(thread); i++) {
> +               int err = pthread_join(thread[i], NULL);
> +
> +               if (err)
> +                       pass = false;
> +       }
>
>         pthread_mutex_destroy(&mutex);
>
> -       piglit_report_result(PIGLIT_PASS);
> +       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
>         return 0;
>  }
> --
> 2.11.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list