Re: [PATCH] pcmcia event thread. (fwd)

From: Alan Cox (alan@lxorguk.ukuu.org.uk)
Date: Thu Nov 16 2000 - 08:39:05 EST


> > up_and_exit() would do it. Or preferably passing the address of the
> > semaphore as an extra argument to kernel_thread() in the first place.
>
> Any solution which involves a function being called from a kernel
> thread, and/or passing another arg to a kernel thread, is a non-starter
> ... See the discussion about timer_exit() a while ago. This sort of

timer_exit is a completely unrelated situation

> IMHO it is possible to solve this in a generic way without having to
> change the code for every single kernel thread.

It comes entirely down to one thing. The termination function of the thread
has to be code in the kernel code not a module. Thats it, nothing else. So
you just need some kind of sleep/wakeup proceedure for it.

As far as I can see all you need is

wait_and_die(sem)
{
        up(&sem); /* In the kernel so can unload */
        sys_exit(0); /* Never return to the unloaded module code */
}

in the main kernel. In fact if you were bored you could build this on the kernel
stack ;)

-
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/



This archive was generated by hypermail 2b29 : Thu Nov 23 2000 - 21:00:10 EST