[mod_python] Using _global_lock in scripts

Mike Looijmans nlv11281 at natlab.research.philips.com
Mon Apr 10 01:43:37 EDT 2006


> 2. If it is not reasonable, what suggestions do you have for
> implementing concurrent access to a resource from (potentially)
> multiple interpreters and/or child processes?

Run a worker process that manages the resource. Use some form of RPC and 
IPC to communicate with that process. For many things, you can get way 
with using a UNIX or TCP socket, sending a request as a pickled Python 
object (I tend to pickle dictionaries) and getting a response in the 
same way.

The worker process can either run single threaded using a select(), or 
use some standard mutexing to serialize access to your resource.

It would help a lot to know what the mysterious "resource" you want to 
manage is.



More information about the Mod_python mailing list