From: Bradley Nicholes Date: Tue, 28 May 2002 19:32:30 +0000 (+0000) Subject: The lock should have already been released when the connection was closed. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06670f3c68dc3a820fb6aa0350f78cf7dba10b31;p=apache The lock should have already been released when the connection was closed. If it was then releasing it again causes a "releasing an unheld lock" warning on NetWare. To avoid the warning, first try to get the lock before releasing it. The other alternative would be to just assume that the lock has been released when the connection was closed so do nothing. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95323 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/util_ldap.c b/modules/experimental/util_ldap.c index c9de56c6be..9bd7682b72 100644 --- a/modules/experimental/util_ldap.c +++ b/modules/experimental/util_ldap.c @@ -214,7 +214,14 @@ apr_status_t util_ldap_connection_destroy(void *param) ldc->ldap = NULL; } - /* release the lock we were using */ + /* release the lock we were using. The lock should have + already been released in the close connection call. + But just in case it wasn't, we first try to get the lock + before unlocking it to avoid unlocking an unheld lock. + Unlocking an unheld lock causes problems on NetWare. The + other option would be to assume that close connection did + its job. */ + apr_thread_mutex_trylock(ldc->lock); apr_thread_mutex_unlock(ldc->lock); return APR_SUCCESS;