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

B. James Phillippe (bryan@terran.org)
Sun, 20 Jun 1999 22:59:12 -0700 (PDT)


On Sat, 19 Jun 1999, Pavel Machek wrote:

> > The problem is that the drivers have threads running that are not dying
> > before I start deallocating resources.
>
> Hmm, you might do something like
> while (sys_kill(pid, SIGTERM) != -1)
> schedule();
...
> Wait. In what context process does cleanup_module() code run? It is
> probably not safe to do blocking call in idle task or something
> similary bad.

Blocking in cleanup_module is okay; it's run in the context of whatever
process is calling the delete_module system call (eg. rmmod). The real
problem is being sure that cleanup_module does not return until the thread
associated with that module is truly gone. waitpid should really be the
right solution (opposed to the semaphore method I suggested, which was
really not very good), but I'm not sure why it wasn't consistently working.

-bp

--
# bryan at terran dot org
# http://www.terran.org/~bryan

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