Re: waitpid advice ? (killing off a kernel thread)

David Waite (mass@ufl.edu)
Sat, 19 Jun 1999 11:29:00 -0400 (EDT)


On Sat, 19 Jun 1999, B. James Phillippe wrote:
> On Sat, 19 Jun 1999, David Waite wrote:
>
> > The problem is that the drivers have threads running that are not dying
> > before I start deallocating resources.
> ...
> > Anyways, my question is.. obviously my method of killing and then waiting
> > for the process to die is not working right. What can I do instead? Wait
>
> I had a similar problem with a modular kernel-thread project that I'm
> working on. I solved it by using a semaphore to coordinate the module
> unloading and thread cleanup. Something like this:

Yes, this is sort of what I have deemed a 'last resort' though, mostly
because releasing the semaphore cannot be done after the thread exits,
only before.. so I will still have a chance of executing code in memory
that was deallocated when the module was unloaded.

It is like acting on the rising edge rather than the falling edge.

But if i can't find anything else (and nobody else comes up with a better
suggestion) I'll do it this way - having the machine hang is a
surprisingly large motivator for taking a less-than-perfect approach
that is quicker :)

-David Waite

-
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/