467,888 Members | 1,358 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

Can I load and run modules inside threads....


..... and is it a good idea???

I am thinking of writing a controlling module - call it a postmaster if
you will - that will start submodules and pass them work via queues -
one input queue per module. The modules will send their results back to
the postmaster via its queue. The postmaster will then read the
incoming message and, if necessary, pass it on to another thread.

The problem is that I want the submodules NOT to be known by or part of
the original module. So I have to load them as the need is seen,
probably by name, and tie them to queues. Can anyone see a problem with
this or some good way to do it?

Maybe,

modname = ....... #Module name a variable
exec("import %s as mod" % modname)
module_input_queue = Queue.Queue()
new_thread = mod.classname(
my_queue, module_input_queue, parms)
new_thread.start()

Jun 26 '06 #1
  • viewed: 717
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Nick Coghlan | last post: by
15 posts views Thread by Nick Coghlan | last post: by
6 posts views Thread by Shabam | last post: by
7 posts views Thread by George Copeland | last post: by
4 posts views Thread by Ravi Ambros Wallau | last post: by
173 posts views Thread by Zytan | last post: by
reply views Thread by bernhard.voigt | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.