(no subject)

Alan Cox (alan@lxorguk.ukuu.org.uk)
Wed, 9 May 2001 18:15:46 +0100 (BST)


> from the interrupt back to the driver. This is not unlike what you must
> already be doing for interrupt completion.
>
> Do pay attention to getting the timer (&t->timer above) properly set up
> (see my first response or most any usage in the kernel).
>
> Have I got this right Alan?

The other thing to watch is that you need to delete the timer before you unload
As you can safely del_timer() an initialised but already deleted timer that
isnt too onerous.

Waiting for a thread in the module unload is trickier. You cannot simply kill
the thread as it may run after cleanup_module() returns. Instead you do

static void cleanup_module(void)
{
kill_thread();
down(&thread_sem);
printk("Thread dead\n");
}

and in the thread exit path do

up_and_exit(&thread_sem, error_code);

This ensures that the thread of execution has left the module code space and
will not return.

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/