From: Roland Dreier <rdreier@cisco.com>
To: Timur Tabi <timur@freescale.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] add function spin_event_timeout()
Date: Fri, 06 Mar 2009 17:11:00 -0800 [thread overview]
Message-ID: <adaiqmmf87v.fsf@cisco.com> (raw)
In-Reply-To: <1236384801-10305-1-git-send-email-timur@freescale.com> (Timur Tabi's message of "Fri, 6 Mar 2009 18:13:21 -0600")
> The function spin_event_timeout() takes a condition and timeout value
> (in jiffies) as parameters. It spins until either the condition is true
> or the timeout expires. It returns non-zero if the condition is true,
> zero otherwise.
What's the motivation for this? Where do you plan to use it?
> + * The function returns non-zero if the @condition evaluated to true, or
It's not a function but rather a macro.
> +#define spin_event_timeout(condition, timeout) \
> +({ \
> + long __timeout = jiffies + (timeout); \
> + while (!(condition) && (jiffies < __timeout)); \
> + (condition); \
> +})
If we're going to make this core infrastructure, it seems we should
implement it with all best practices... eg I would think the while loop
should include cpu_relax().
next prev parent reply other threads:[~2009-03-07 1:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-07 0:13 [PATCH] add function spin_event_timeout() Timur Tabi
2009-03-07 1:11 ` Roland Dreier [this message]
2009-03-07 1:25 ` Timur Tabi
2009-03-07 9:13 ` Jiri Slaby
2009-03-09 20:47 ` Jeremy Fitzhardinge
2009-03-09 20:51 ` Timur Tabi
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=adaiqmmf87v.fsf@cisco.com \
--to=rdreier@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=timur@freescale.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.