Messages in this thread | | | Date | Thu, 12 Mar 2009 11:19:57 -0500 | From | Timur Tabi <> | Subject | Re: [PATCH v4] introduce macro spin_event_timeout() |
| |
Grant Likely wrote:
> #define spin_until_timeout(condition, timeout, rc) \ > for (unsigned long __timeout = jiffies + (timeout); \ > (!(rc = (condition)) && time_after(jiffies, __timeout)); )
Ooo, that's good.
I'm still not crazy about using jiffies, since it doesn't get incremented when interrupts are disabled, and I'd like this function to work in those cases. How about get_cycles()? I know it's not supported on all platforms, but I'm willing to live with that.
The other problem with get_cycles() is that there doesn't appear to be a num_cycles_per_usec() function, so there's no way for me to scale the count to a fixed time period.
-- Timur Tabi Linux kernel developer at Freescale
| |