Messages in this thread | | | Date | Tue, 30 Dec 2003 21:06:18 -0800 (PST) | From | Davide Libenzi <> | Subject | Re: [PATCH 1/2] kthread_create |
| |
On Wed, 31 Dec 2003, Rusty Russell wrote:
> +struct kt_message > +{ > + struct task_struct *from, *to; > + void *info; > +}; > + > +static struct kt_message ktm; > + > +static void ktm_send(struct task_struct *to, void *info) > +{ > + spin_lock(&ktm_lock); > + ktm.to = to; > + ktm.from = current; > + ktm.info = info; > + if (ktm.to) > + wake_up_process(ktm.to); > + spin_unlock(&ktm_lock); > +} > + > +static struct kt_message ktm_receive(void) > +{ > + struct kt_message m; > + > + for (;;) { > + spin_lock(&ktm_lock); > + if (ktm.to == current) > + break; > + current->state = TASK_INTERRUPTIBLE; > + spin_unlock(&ktm_lock); > + schedule(); > + } > + m = ktm; > + spin_unlock(&ktm_lock); > + return m; > +}
Wouldn't it be better to put a kt_message inside a tast_struct?
- Davide
- 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/
| |