Doing them as wait queues is the obvious answer: turning
cli();
if (cond)
sleep_on(&cond_list);
into
current->state = TASK_UNINTERRUPTIBLE;
add_wait_queue(&wait, &cond_list);
if (cond)
schedule();
remove_wait_queue(..)
always works, but can often be fairly nasty.
Especially considering that for performance reasons you usually want to
turn it into
if (cond) {
current->state = TASK_UNINTERRUPTIBLE;
add_wait_queue(&wait, &cond_list);
if (cond)
schedule();
remove_wait_queue(..)
}
so that you only do the wait queue stuff if you think you need to.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/