summaryrefslogtreecommitdiff
path: root/util-misc
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2018-06-21 14:45:47 +0000
committerYann Ylavic <ylavic@apache.org>2018-06-21 14:45:47 +0000
commit9ce4e0092f0b14a303b121813af2bf3b7cb55c32 (patch)
treea4239363de5d008a6da6fb333c9e07d830da2dc7 /util-misc
parentddd1fef17274ddfd8a78f5278b61788aab2f6bad (diff)
downloadapr-9ce4e0092f0b14a303b121813af2bf3b7cb55c32.tar.gz
apr_reslist: follow up to r1834023: avoid unnecessary apr_time_now() calls.
When ttl=0 is configured, we never need to check for expiry. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1834024 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'util-misc')
-rw-r--r--util-misc/apr_reslist.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/util-misc/apr_reslist.c b/util-misc/apr_reslist.c
index 0373fbc53..3a146d746 100644
--- a/util-misc/apr_reslist.c
+++ b/util-misc/apr_reslist.c
@@ -81,7 +81,9 @@ static apr_res_t *pop_resource(apr_reslist_t *reslist)
static void push_resource(apr_reslist_t *reslist, apr_res_t *resource)
{
APR_RING_INSERT_HEAD(&reslist->avail_list, resource, apr_res_t, link);
- resource->freed = apr_time_now();
+ if (reslist->ttl) {
+ resource->freed = apr_time_now();
+ }
reslist->nidle++;
}
@@ -332,7 +334,7 @@ APR_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
{
apr_status_t rv;
apr_res_t *res;
- apr_time_t now;
+ apr_time_t now = 0;
#if APR_HAS_THREADS
apr_thread_mutex_lock(reslist->listlock);
@@ -340,7 +342,9 @@ APR_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist,
#endif
/* If there are idle resources on the available list, use
* them right away. */
- now = apr_time_now();
+ if (reslist->ttl) {
+ now = apr_time_now();
+ }
while (reslist->nidle > 0) {
/* Pop off the first resource */
res = pop_resource(reslist);