apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r443031 - in /apr/apr-util/trunk: CHANGES include/apr_reslist.h misc/apr_reslist.c
Date Wed, 13 Sep 2006 17:09:01 GMT
Author: rooneg
Date: Wed Sep 13 10:09:00 2006
New Revision: 443031

URL: http://svn.apache.org/viewvc?view=rev&rev=443031
Log:
Add an apr_reslist_acquired_count API for determining how many outstanding
resources there are in a reslist.

Submitted by: Ryan Phillips <ryan trolocsis.com>

* include/apr_reslist.h
  (apr_reslist_acquired_count): Declare.

* misc/apr_reslist.c
  (apr_reslist_acquired_count): Implement.

* CHANGES: Note change.

Modified:
    apr/apr-util/trunk/CHANGES
    apr/apr-util/trunk/include/apr_reslist.h
    apr/apr-util/trunk/misc/apr_reslist.c

Modified: apr/apr-util/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/CHANGES?view=diff&rev=443031&r1=443030&r2=443031
==============================================================================
--- apr/apr-util/trunk/CHANGES (original)
+++ apr/apr-util/trunk/CHANGES Wed Sep 13 10:09:00 2006
@@ -1,5 +1,8 @@
 Changes with APR-util 1.3.0
 
+  *) Add an apr_reslist_acquired_count, for determining how many outstanding
+     resources there are in a reslist.  [Ryan Phillips <ryan trolocsis.com>]
+
   *) Provide folding in autogenerated .manifest files for Win32 builders
      using VisualStudio 2005  [William Rowe]
 

Modified: apr/apr-util/trunk/include/apr_reslist.h
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/include/apr_reslist.h?view=diff&rev=443031&r1=443030&r2=443031
==============================================================================
--- apr/apr-util/trunk/include/apr_reslist.h (original)
+++ apr/apr-util/trunk/include/apr_reslist.h Wed Sep 13 10:09:00 2006
@@ -125,6 +125,12 @@
                                           apr_interval_time_t timeout);
 
 /**
+ * Return the number of outstanding resources.
+ * @param reslist The resource list.
+ */
+APU_DECLARE(apr_uint32_t) apr_reslist_acquired_count(apr_reslist_t *reslist);
+
+/**
  * Invalidate a resource in the pool - e.g. a database connection
  * that returns a "lost connection" error and can't be restored.
  * Use this instead of apr_reslist_release if the resource is bad.

Modified: apr/apr-util/trunk/misc/apr_reslist.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/misc/apr_reslist.c?view=diff&rev=443031&r1=443030&r2=443031
==============================================================================
--- apr/apr-util/trunk/misc/apr_reslist.c (original)
+++ apr/apr-util/trunk/misc/apr_reslist.c Wed Sep 13 10:09:00 2006
@@ -362,6 +362,17 @@
     reslist->timeout = timeout;
 }
 
+APU_DECLARE(apr_uint32_t) apr_reslist_acquire_count(apr_reslist_t *reslist)
+{
+    apr_uint32_t count;
+
+    apr_thread_mutex_lock(reslist->listlock);
+    count = reslist->ntotal - reslist->nidle;
+    apr_thread_mutex_unlock(reslist->listlock);
+
+    return count;
+}
+
 APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
                                                  void *resource)
 {



Mime
View raw message