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

Re: OpenLDAP 2.0 beta on NT




Roger-

2.0 beta builds and compiles cleanly on NT (without sasl), but goes to 100%
cpu utilization after the first query, due to a tight loop in
ldap_int_thread_pool_wrapper. This is because of bugs in the pthread
emulation (thr_nt.c) - in ldap_pvt_thread_cond_wait the SignalObjectAndWait
call fails with an unchecked error of 'attempt to release mutex not owned by
caller' so no wait occurs.

The best solution I believe is to replace the existing pthread emulation
with pthreads-win32 (http://sources.redhat.com/pthreads-win32/) a high
quality open source emulation. Set 'HAVE_PTHREAD' and 'HAVE_PTHREADS_FINAL'
and use thr_posix.c rather than thr_nt.c (which can be removed.)

Here is a temporary fix for WinNT threads. There are other things in thr_nt.c that are problematic, and I am trying to get the time to rework that code. Of course, pthreads-win32 is an option too, if you can use LGPL code.


Mark.



Index: ldap/libraries/libldap_r/thr_nt.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap_r/thr_nt.c,v
retrieving revision 1.14
diff -u -2 -r1.14 thr_nt.c
--- ldap/libraries/libldap_r/thr_nt.c	2000/06/13 00:42:13	1.14
+++ ldap/libraries/libldap_r/thr_nt.c	2000/07/14 13:43:11
@@ -97,5 +97,5 @@
 {
 	ReleaseMutex( *mutex );
-	SignalObjectAndWait( *mutex, *cond, INFINITE, FALSE );
+	WaitForSingleObject( *cond, INFINITE );
 	WaitForSingleObject( *mutex, INFINITE );
 	return( 0 );