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

Programming with threads and -lldap(_r)



Greetings all.

I'm programing a small benchmarking program using POSIX-threads and
libldap(from OpenLDAP). I'm using -lldap_r to make sure the program is
thread-safe. My question is this; is ldap_simple_bind also
thread-safe? Does it use any unprotected gethostbyname() or other
none-safe methods? I've looked thru some of the code looking for
gethostbyname() and the likes, but I haven't found any.

Currect code looks like this:

      pthread_mutex_lock( &mutex );
      msgid = ldap_simple_bind( ld, NULL, NULL );
      pthread_mutex_unlock( &mutex );

Can I remove the mutex?

-- 
Mathias Meisfjordskar
GNU/Linux addict.

"If it works; HIT IT AGAIN!"