Use a Thread to reload a Module?

Hendrik van Rooyen mail at microcorp.co.za
Sat Dec 23 02:19:36 EST 2006


 "Gregory Piñero" <gregpinero at gmail.com> wrote:


> Hi Python Experts,
>
> I hope I can explain this right.  I'll try.
>
> Background:
> I have a module that I leave running in a server role.  It has a
> module which has data in it that can change.  So every nth time a
> function in the server gets called, I want to reload the module so it
> has the freshest data.  But there's a lot of data so it takes 5-10
> seconds to do a reload.
>
> My question is:
> Would I be able to launch a seperate thread to reload the module while
> the server does it work?  Hopefully it would be using the old module
> data right up until the thread was finished reloading.
>

have you looked at putting the data into a persistent dict?

- Hendrik




More information about the Python-list mailing list