Sean McGrath writes:
 > I want to synchronize ...
 > 
 > I tried using the threading module and creating
 > a Lock object as a global in the external method.
 > This does not help as each request gets allocated its
 > own Lock object....

As you observed, each thread gets its own global namespace
for a file containing an external method.

The namespace of a true Python module, however, is shared
by all threads. Therefore, it is a good place for your
lock.

Do the following (or something along similar lines):

 * create a properly named subpackage in "lib/python/Shared"
   (to avoid name clashes), say "myCompany".

 * create a Python module in "myCompany", say "myLock.py".

 * create your lock in this module, say "Lock"

 * access it in your external method by:

        from Shared.myCompany.myLock import Lock



Dieter

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to