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

From: Linus Torvalds (torvalds@transmeta.com)
Date: Mon Jun 17 2002 - 16:02:22 EST


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/



This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:14 EST