lkml.org 
[lkml]   [1999]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: 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/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.100 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site