Re: workqueue - process context

From: Roland Dreier
Date: Sat Feb 19 2005 - 00:05:21 EST


Vicente> What if I need the module to be unloaded cause It's
Vicente> mutually exclusive with another module to be loaded, and
Vicente> I still need to run the works in a workqueue time before
Vicente> that happens? That's completely out of the picture?cause
Vicente> that might be useful.

That doesn't sound like a good idea. For one thing, how does the
second module get the workqueue pointer from the first module? The
simplest solution would be for each module to create and destroy its
own workqueue. However, if you really need a shared workqueue for
some reason, then have a simple third module that can remain loaded
and have it manage the workqueue for both of your other modules.

Roland> By the way, the module (or any code calling
Roland> destroy_workqueue()) must make sure that it has race
Roland> conditions that might result in work being submitted to
Roland> the queue while it is being destroyed.

Vicente> yes, I think flushing is enough, is it?

Usually, but you have to be extra-careful if you have any work
functions that might resubmit themselves.

- Roland

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