Re: waiting on a condition

From: Richard B. Johnson
Date: Thu Oct 14 2004 - 10:51:11 EST


On Thu, 14 Oct 2004, Davide Rossetti wrote:

> Martijn Sipkema wrote:
>
> >On Wed, 2004-10-13 at 17:30, Peter W. Morreale wrote:
> >
> >
> >>Have you looked at the wait_event() family yet? Adapting that
> >>methodolgy might
> >>suit your needs.
> >>
> >>
> >
> >wait_event() seems to be what I was looking for; I don't really like the
> >condition being an argument.
> >
> >
> >
> you may have a look at http://lwn.net/Articles/22913/
> it's interesting :)
> regards


You could always do:

while(whatever)
{
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(0);
if(signal_pending(current))
break; // Or do something else
}
set_current_state(TASK_RUNNING); // Probably redundant

You could also set a specific HZ for the timeout, and count
them for a "never happened" timeout.




Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.

-
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/