Re: killing NPTL threads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ramagudi

I try to answer with a limited knowledge of NPTL...
Hello,

Let's say main program creates a secondary thread, which blocks on
a file descriptor (e.g. when trying to read);

probably you should read "BUGS" section in "man pthread_cancel".

Now main program wants to terminate.

Does it have to cancel/terminate the secondary thread first ?
I think yes, at least that's the clean way to do it.
can it cancel it ? how ? will pthread_cancel work ?

I guess yes. You may use pthread_cancel() together with pthread_setcanceltype(PTHREAD_CAN-CEL_ASYNCHRONOUS) to enforce cancellation as soon as possible. If not, by default it will be deffered into the next earliest cancellation point.
If it will not cancel the secondary thread, but just exit() instead,
will the other thread keep running in the system ?
Now this is something I am not sure. IIRC, when a parent process is killed, all its descendants are also killed. However, when the child is doing something when being killed, it is killed "rudely", so it might leave a defect e.g while doing write(), you suddenly kill it, then you might lost data since the data memory aren't completely transfered into page caches.

regards,

Mulyadi


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux