Date: Tue, 9 Sep 2008 13:53:57 +0100 From: "kr Lekha" <kr.lekha@gmail.com> To: "kr Lekha" <kr.lekha@gmail.com>, "Rui Paulo" <rpaulo@freebsd.org>, freebsd-hackers@freebsd.org Subject: Re: killing a kthread Message-ID: <96b2ec350809090553q3ba36125nd3da14129da0f2b3@mail.gmail.com> In-Reply-To: <20080903211459.GA60350@zim.MIT.EDU> References: <96b2ec350809030134j73a61369m35395391a1218975@mail.gmail.com> <20080903095605.GB21178@alpha.local> <96b2ec350809030516y2d6f26d1h3cd7eb39231c4da0@mail.gmail.com> <20080903211459.GA60350@zim.MIT.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
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@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. >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96b2ec350809090553q3ba36125nd3da14129da0f2b3>