You want to yield as well otherwise you may just spin anyway
> Both of these procedures schedule() while waiting for something to
> happen. The wait can be very long (1 second) so I don't want to
> just spin eating CPU cycles. I have to give the CPU to somebody.
So use a timer
void tick_tick_boom(unsigned long l)
{
struct my_device *d = (struct my_device *)l;
if(its_still_busy(d))
{
d->timer_count--;
if(d->timer_count)
{
/* Try again until timer_count hits zero */
add_timer(&t->timer, jiffies+1);
return;
}
else
{
/* Lose some .. */
d->event_status = TIMEOUT;
}
}
else
{
/* Win some .. */
d->event_status = OK;
}
/* Wake up the invoker */
wake_up(&d->timer_wait);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/