All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Taylor Simpson <tsimpson@quicinc.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test
Date: Tue, 12 Jan 2021 20:22:54 +0000	[thread overview]
Message-ID: <87bldtnbsw.fsf@linaro.org> (raw)
In-Reply-To: <1610476384-13760-1-git-send-email-tsimpson@quicinc.com>


Taylor Simpson <tsimpson@quicinc.com> writes:

> ---
>  tests/tcg/multiarch/testthread.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/tests/tcg/multiarch/testthread.c b/tests/tcg/multiarch/testthread.c
> index 810ba5d..b30b4b5 100644
> --- a/tests/tcg/multiarch/testthread.c
> +++ b/tests/tcg/multiarch/testthread.c
> @@ -50,8 +50,29 @@ void test_pthread(void)
>      printf("End of pthread test.\n");
>  }
>  
> +void *thread3_func(void *arg)
> +{
> +    usleep(3 * 1000);
> +    return 0;
> +}
> +
> +void test_cancel(void)
> +{
> +    pthread_t thread;
> +    void *res;
> +
> +    pthread_create(&thread, 0, thread3_func, NULL);
> +    pthread_cancel(thread);
> +    pthread_join(thread, &res);
> +    if (res != PTHREAD_CANCELED) {
> +        puts("ERROR: thread not cancelled");
> +        exit(EXIT_FAILURE);
> +    }

Aside from the signoff line which I need could you add something like:

      printf("End of pthread cancel test.\n");

just to aid debugging.

Thanks,


> +}
> +
>  int main(int argc, char **argv)
>  {
>      test_pthread();
> +    test_cancel();
>      return 0;
>  }


-- 
Alex Bennée


      parent reply	other threads:[~2021-01-12 20:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 18:33 [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test Taylor Simpson
2021-01-12 18:54 ` no-reply
2021-01-12 20:22 ` Alex Bennée [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bldtnbsw.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=tsimpson@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.