[mod_python] Co-ordinating ccess to a single-use resource

Graham Dumpleton grahamd at dscpl.com.au
Thu Sep 8 12:40:21 EDT 2005


On 09/09/2005, at 2:23 AM, John Simeone wrote:

> Hello to everyone.
>
> I am responsible for a project using Apache 2.0 with mod_python in a 
> Win2k environment, the choice of OS being dictated by the fact that 
> the purpose of the server is to supply access to a proprietary, 
> supplier written Windows program to our user base via the web.
>
> That program is single threaded and provides for only 1 user at a 
> time. Access to the program in Python is through  win32com.
>
> I am using a mod_python.publisher handler.
>
> All the http requests come through a single proxy server with a static 
> address but not all are from browser clients. Some are originating 
> from perl programs but all requests are directed to a single request 
> handler.
>
> Can anyone suggest a method to control access to this single user 
> resource. In a non-web programming environment, I'd just use a mutex 
> semaphore to co-ordinate access among the threads but I am too much of 
> newbie with mod_python and Apache to implement a workable solution so 
> far.
>
> What mechanism can I use to create a shared resource that I can lock 
> and have other requests wait until the resource is unlocked?

When using mod_python under Win32 platform, there is effectively only
one process and requests are handled in separate threads. Because of
this, you should be able to mediate access to the shared resource
through a normal thread mutual exclusion locking mechanism just as
easily as you would in a non web environment.

Graham



More information about the Mod_python mailing list