Re: [PATCH v4] introduce macro spin_event_timeout()

From: Timur Tabi
Date: Thu Mar 12 2009 - 11:55:00 EST


On Wed, Mar 11, 2009 at 9:45 PM, Grant Likely <grant.likely@xxxxxxxxxxxx> wrote:

>> The other big advantage of that approach is that drivers that aren't in
>> an atomic section can use msleep() and allow the kernel to schedule on
>> that processor.
>
> Ack! I totally agree.

I'm glad everyone agrees. I still don't know how to solve the
problem, though. I came up with this:

#define spin_until_timeout(condition, timeout) \
for (unsigned long __timeout = jiffies + (timeout); \
(!(condition) && time_after(jiffies, __timeout)); )

Now how do I modify this so that the caller knows whether the loop
terminated because of a timeout or the condition became true?

--
Timur Tabi
Linux kernel developer at Freescale
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/