I've made two fixes (I hope) to the concurrency commit, please review:
- I inverted the test in NT threads MUTEX_FIRSTCREATE. I assume LDO_MUTEX_NULL = (HANDLE)0 is not a valid handle, so FIRSTCREATE must initialize m if it *is* 0, not if is *not*.
- In do_abandon(), protected ldap_free_connection() with ld->ld_conn_mutex. The function would unlock it when it did not own the mutex.
However I do not know why the mutex was moved out of ldap_free_connection(), so maybe something more needs to be done.
Also I've cleaned up macros and namespace:
Add proper values for NO_THREADS. Support LDAP_THREAD_DEBUG. Define LDAP_INT_* and LDAP_DEBUG_* in ldap_int_thread.h, LDAP_PVT_* in ldap_pvt_thread.h.
libraries/libldap/ldap-int.h: Remove unnecessary #ifdef LDAP_R_COMPILE for LDAP_NEXT_MSGID.
define LDAP_LDO_MUTEX_NULLARG as ,LDAP_PVT_MUTEX_NULL or empty in the same place which decides whether the initializer is needed.
Wrap some macros and arguments in parens or do{}while(0), so they can be used more like C statements. Also replace empty macros with ((void) 0) expansions, to shut up 'empty statement' compiler warnings.
Finally, I've another wish for the test060-mt-hot:
This test takes way to long under Valgrind. It ought to obey $TESTLOOPS (default 50) like the concurrency tests do: Set parameters to run ca $TESTLOOPS/50 of the current time.
I don't know which parameters it's best to reduce in that case, however?