From: Titus B. <ti...@ca...> - 2002-11-08 21:24:28
|
-> Suppose I want a persistent resource that all pywx pages can access. -> -> Say I run pywx in single-interpreter mode. -> At startup I have the interpreter import a few modules written be me. -> -> In these modules I define resource pools ( containing database handles for -> example ) pseudo-public methods ( pseudo since you can't create private -> name-space in python such that I know ) to access them, and mutexes ( -> thread.allocate_lock() works? ) to synchronize said access. -> -> I then access in the namespace of these modules only those functions that I -> have written with public-safety in mind. -> -> Is this the general idea? That should work just fine, yes. You should initialize the resource pools on import, to avoid initializing them more than once; apart from that, make sure you are running in multithreaded (as opposed to multi-interpreter) mode. cheers, --titus |