Completely async...

Michael Ströder michael at
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/ to the
CVS repository. See __doc__ string:

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

Do anything you want with this module.

- 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).

You can simply use function open() of this module instead of
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
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