I know the locking gets exercised (both libldap and GnuTLS sides) during
connection and TLS handshake, so I tested this by doing a
bind/search/unbind loop on a bunch of parallel threads.
I built master with this patch in all of the following environments:
Debian 8 (jessie), GnuTLS 3.3.30
Debian 9 (stretch), GnuTLS 3.5.8
Debian 10 (buster), GnuTLS 3.6.7
Debian unstable (sid), GnuTLS 3.6.9
FreeBSD 12.0, GnuTLS 3.6.8
Solaris 11.4, GnuTLS 3.5.16, --with-threads=lwp
Solaris 11.4, GnuTLS 3.5.16, --with-threads=posix
Windows 10 (MinGW), GnuTLS 3.6.8, --with-threads=nt
Windows 10 (MinGW), GnuTLS 3.6.8, --with-threads=posix
and ran my test program successfully on all of them.
On each of these I also stepped into the debugger and confirmed that the
expected calls happened (gnutls_system_mutex_lock calling resp.
pthread_mutex_lock or EnterCriticalSection, ldap_pvt_thread_mutex_lock
calling the expected API, etc).
Any further comments, or suggestions for additional tests I should run?