[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: Multi-threaded Client Development With libldap_r



> -----Original Message-----
> From: Jason Raneses [mailto:jason@raneses.com]
> Sent: Sunday, February 01, 2004 11:50 PM
> To: 'Howard Chu'; openldap-software@OpenLDAP.org
> Subject: RE: Multi-threaded Client Development With libldap_r
>
>
> Howard, in looking at the back-ldap source, it looks like
> it's safe for
> multiple threads to simultaneously use a single LDAP handle
> for searching in
> 2.2.x.  Is that correct?  I did notice some mutex code in the
> places you'd
> usually see thread synchronization being performed (bind.c, init.c,
> unbind.c), however it was hard for me to discern what
> functions I should be
> "extremely careful" when calling besides the usual suspects
> (those used
> during bind and unbind operations, for example)...can you
> give me a short
> rundown on what I should specifically watch out for?

The code in back-ldap generally works, with the possible exception of
searches with/without DEREF set. What certainly will not work, for example,
is using ldap_get_option to retrieve status on the "last" operation, e.g.,
LDAP_OPT_ERROR_NUMBER, since there is only one error variable in the LDAP*
handle, and no way to know which operation last touched it. Any part of the
API that must use ldap_get_option/ldap_set_option on a specific operation
cannot be relied on. That's the most obvious problem. I don't have time now
to elaborate further.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support