Date: Thu, 10 Aug 2006 17:16:17 +0200 From: Divacky Roman <xdivac02@stud.fit.vutbr.cz> To: hackers@freebsd.org Subject: SoC: help with LISTs and killing procs Message-ID: <20060810151616.GA17109@stud.fit.vutbr.cz>
index | next in thread | raw e-mail
hi
I am doing this:
(pseudocode)
LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) {
kill(em, SIGKILL);
}
kill(SIGKILL) calls exit() which calls my exit_hook()
my exit_hook() does LIST_REMOVE(em, threads).
the problem is that this is not synchronous so I am getting a panic by INVARIANTS
that "Bad link elm prev->next != elm". This is because I list 1st item in the list
I call kill on it, then process 2nd list, then scheduler preempts my code and calls
exit() on the first proc which removes the first entry and bad things happen.
I see this possible solutions:
make this synchronous, it can be done by something like:
....
kill(em, SIGKILL);
wait_for_proc_to_vanish();
pls. tell me what do you think about this solution and if its correct what is the wait_for_proc_to_vanish()
maybe there's some better solution, pls tell me.
thnx a lot
roman
----------------------
www.liberalnistrana.cz
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060810151616.GA17109>
