Accessing the same LDAP* from multiple threads at once is always undefined, even if one thread is just polling ldap_result. Instead keep one thread per connection and issue blocking queries on the thread.