Re: set_current_state() vs current->state

From: Manfred (manfred@colorfullife.com)
Date: Mon Oct 02 2000 - 06:06:42 EST


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/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:09 EST