Re: [patch] v2.5.22 - add wait queue function callback support

Linus Torvalds (torvalds@transmeta.com)
Mon, 17 Jun 2002 14:02:22 -0700 (PDT)


On Mon, 17 Jun 2002, Benjamin LaHaise wrote:
>
> Anyways, the patch below changes add_wait_queue_cond
> to use spin_locks directly.

Can you do one more thing for me: change the "NULL" in the wake function
to be a "default_wake_function()" that looks something like

int default_wake_function(task_t *p, unsigned int mode, int sync)
{
return (p->state & mode) && try_to_wake_up(p, sunc);
}

and then you just make the code in __wake_up_common() do

list_for_each(tmp, &q->task_list) {
curr = list_entry(tmp, wait_queue_t, task_list);
p = curr->task;
if (curr->func(p, mode, sync) &&
((curr->flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive))
break;
}

instead of having separate code-paths for the "func" and the default
wake-up action.

In short, the event "func" could never be NULL, and would always return
whether the wakeup/event was "successful" from an exclusivity standpoint.

Linus

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