Re: set_current_state() vs current->state

Manfred (manfred@colorfullife.com)
Mon, 02 Oct 2000 13:06:42 +0200


Andrea wrote:
> In short you need set_current_state(x) when you do something that relies on the
> ordering like:
>
> set_current_state(TASK_UNINTERRUPTIBLE)
> if (event_happened_meanwhile)
> break;
> schedule();

Btw, even if the code is protected with a spinlock you must use
set_current_state, spin_unlock() is only a partial memory barrier (at
least on i386 and ia64).

set_current_state(TASK_UNINTERRUPTIBLE)
/* __set_current_state() can lock up */
spin_unlock(&lock);
if (event_happened_meanwhile)
break;
schedule();

--
	Manfred
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/