Hi,
On Mon, 29 Jan 2001, Andi Kleen wrote:
> You can miss wakeups. The standard pattern is:
>
> get locks
>
> add_wait_queue(&waitqueue, &wait);
> for (;;) {
> if (condition you're waiting for is true)
> break;
> unlock any non sleeping locks you need for condition
> __set_task_state(current, TASK_UNINTERRUPTIBLE);
> schedule();
> __set_task_state(current, TASK_RUNNING);
> reaquire locks
> }
> remove_wait_queue(&waitqueue, &wait);
You still miss wakeups. :)
Always set the task state first, then check the condition. See the
wait_event*() macros you mentioned for the right order.
bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/
- Re: [ANNOUNCE] Kernel Janitor's... Rasmus Andersen
- Re: [ANNOUNCE] Kernel Janitor's... Peter Samuelson
- Re: [ANNOUNCE] Kernel Janitor's... Ingo Oeser
- Re: [ANNOUNCE] Kernel Janitor's... David Woodhouse
- Re: [ANNOUNCE] Kernel Janitor's... Timur Tabi
- Re: [ANNOUNCE] Kernel Janitor's... Daniel Phillips
- Re: [ANNOUNCE] Kernel Janitor's... Timur Tabi
- Re: [ANNOUNCE] Kernel Janitor's... David Woodhouse
- Re: [ANNOUNCE] Kernel Janitor's... David Woodhouse
- Re: [ANNOUNCE] Kernel Janitor's... Andi Kleen
- Re: [ANNOUNCE] Kernel Janitor's... Roman Zippel
- Re: [ANNOUNCE] Kernel Janitor's... Andi Kleen
- Re: [ANNOUNCE] Kernel Janitor's... Andrea Arcangeli
- Re: [ANNOUNCE] Kernel Janitor's... Andrea Arcangeli
- Re: [ANNOUNCE] Kernel Janitor's TOD... Alan Cox
- Re: [ANNOUNCE] Kernel Janitor's... Manfred Spraul
- Re: [ANNOUNCE] Kernel Janitor's TODO list Rusty Russell
- Re: [ANNOUNCE] Kernel Janitor's TODO list Andrew Morton

