Completely async...

Michael Ströder michael at stroeder.com
Mon May 14 12:28:23 CEST 2001


Michael Ströder wrote:
> 
> I wrote a drop-in replacement class for LDAPObject for locking calls
> into the LDAP libs since these are not completely thread-safe

I've added this module as python-ldap/Lib/ldapthreadlock.py to the
CVS repository. See __doc__ string:

"""
ldapthreadlock.py - mimics LDAPObject class in a thread-safe way
(c) by Michael Stroeder <michael at stroeder.com>

License:
Do anything you want with this module.

Compability:
- The behaviour of the ldapthreadlock.LDAPObject class should be
  exactly the same like ldap.LDAPObject
- This module needs your Python installation to be built with
  thread support (module threading is imported).

Usage:
You can simply use function open() of this module instead of
function
open() of module ldap to create an instance of LDAPObject class.

Basically calls into the LDAP lib are serialized by the module-wide
lock _ldapmodule_lock. To avoid blocking of other threads
synchronous
methods like search_s() etc. and the result() method were rewritten
to do
solely asynchronous LDAP lib calls with zero timeout.

The timeout handling is done within the method result() which
probably leads
to less exact timing.
"""

Ciao, Michael.




More information about the python-ldap mailing list