lkml.org 
[lkml]   [2000]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: set_current_state() vs current->state
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/

\
 
 \ /
  Last update: 2005-03-22 12:39    [W:0.031 / U:2.924 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site