killing a kthread
kr Lekha
kr.lekha at gmail.com
Tue Sep 9 12:53:59 UTC 2008
Hi all,
thanks very much for your valuable inputs.
I found out the way to exit the thread.
Problem was psignal(p, SIGKILL); , the p->p_siglist was being reset after
propagating this signal to threads associated with this proc.
Hence i could poll once in a way if any unhandled signals were in
curthread->td_siglist.
I am not sure if this is the optimal solution.
Please do sugest if you have a better solution
Why cant we have signal handlers for kernel threads? when i tried to
register one, sigaction returned value 14 and signal handler didnt get
registered.
Thanks,
lekha
On Wed, Sep 3, 2008 at 10:14 PM, David Schultz <das at freebsd.org> wrote:
> On Wed, Sep 03, 2008, kr Lekha wrote:
> > I understand when thread finishes it should call kthread_exit().
> > but if this thread was suspended before it finished, it might not be able
> to
> > call kthread_exit().
> >
> > Due to which we still see the thread suspended. I am unable to kill it
> > even with killproc / psignal with in the kernel module.
>
> That's by design. Kernel threads can hold arbitrary kernel
> resources, and there's no mechanism to clean up after them
> automatically. They are expected to clean up after themselves and
> exit gracefully. In your case, you'll need to wake up the
> suspended thread and somehow notify it that you want it to
> terminate.
>
More information about the freebsd-hackers
mailing list