Messages in this thread | | | From | sergey@memco ... | Date | Mon, 4 Oct 1999 16:25:56 -0400 | Subject | Re: Threads |
| |
"Richard B. Johnson" <root@chaos.analogic.com> on 10/04/99 12:58:03 PM
Richard B Johnson worte:
>On Mon, 4 Oct 1999, Stanislav Krasilovskiy wrote:
>> Hi, >> >> I have a short question, but I lack the expertise to answer it. >> >> I am creating a thread in a custom system call, through a call to >> kernel_thread(). When this thread finishes, it becomes a zombie and >> persists until the user program which called the system call exits. Is >> there any way to all to make the kernel thread die cleanly when it >> finishes? (Without doing something like waitpid()). >> >> Thank you very much.
>Make a signal handler for the children (a generic one for all of them). > >#include<signal.h> >#include<sys/wait.h> > >void reaper(int unused) >{ > while(wait3(&unused, WNOHANG, NULL) > 0) > ; >} > *** SKIPPED *** >
Where is a better idea. Just change a parent to INIT process.
First detach process from old parent ( look at sys_wait() for help ) and
attach it to process #1 ( sys_fork() ). Don't forget lock kernel before.
Unfortunatly multiprocessor LINUX still has uniprocessor kernel.
Sergey Tsybanov
- 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/
| |