From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] pthread_cancel_3-1: rewrite
Date: Wed, 13 Jun 2018 06:19:22 -0400 (EDT) [thread overview]
Message-ID: <75877603.26215925.1528885162414.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2dvo6TC4dfbSTuPXJY3CPiOMy4K62fKe_YDjk=y7xiDHg@mail.gmail.com>
----- Original Message -----
> Jan Stancek <jstancek@redhat.com> wrote:
>
> > This test sets priorities, measures time, tries to synchronize
> > threads with integers and sleeps for seconds. And there appears
> > to be race somewhere that makes it rarely fail.
> >
> > The premise tested is that action triggered by pthread_cancel
> > runs asynchronously. This rewrite takes simpler approach:
> >
> > Thread sleeps until it can observe variable set by parent
> > _after_ pthread_cancel() or after it hits specified timeout.
> > If timeout is hit, then presumably cleanup_func() didn't
> > run in parallel with main thread and test fails.
> >
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > [...]
> >
> > +static void cleanup_func(void *unused)
> >
>
> To get rid of compile warning:
> static void cleanup_func(void *unused __attribute__((unused)))
Sure, but I'd rather mirror LTP_ATTRIBUTE_UNUSED to posixtest.h.
>
>
>
> > +{
> > + do {
> > + usleep(SLEEP_MS*1000);
> > + thread_sleep_time += SLEEP_MS;
> > + } while (after_cancel == 0 && thread_sleep_time < TIMEOUT_MS);
> > +}
> > +
> > +static void *thread_func(void *unused)
> >
>
> Here as well.
>
>
> Others looks good to me.
Thanks for review,
Jan
>
>
> --
> Regards,
> Li Wang
>
next prev parent reply other threads:[~2018-06-13 10:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 12:33 [LTP] [PATCH v2] pthread_cancel_3-1: rewrite Jan Stancek
2018-06-05 2:02 ` Li Wang
2018-06-13 10:19 ` Jan Stancek [this message]
2018-06-19 11:13 ` Jan Stancek
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=75877603.26215925.1528885162414.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox