Why LDAPObject.._ldap_object_lock around library calls?

Michael Ströder michael at stroeder.com
Wed May 5 07:50:20 CEST 2004


Ken Key wrote:
> 
>   I'm having a little trouble with the _ldap_object_lock in the
> LDAPObject around ldap library function calls.

Which trouble do you have?

>  Is the link
> to protect against threads making function calls when the _ldap
> module is linked against the non-reentrant version of the libldap?
> That is, wouldn't it be safe to get rid of the _ldap_object_lock
> references in LDAPObject._ldap_call() if the module is linked
> against libldap_r?  Or is there some other, non-threadsafe reason
> that I'm missing?

According to related postings on the OpenLDAP lists libldap_r is re-entrant 
on a per-connection basis. Therefore linking with libldap_r improves the 
situation since a finer-grained locking is used in LDAPObject class (see 
method _ldap_lock()).

Note that proper support for libldap_r also depends on the version of the 
OpenLDAP libs used.

Ciao, Michael.



More information about the python-ldap mailing list