You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2018/01/19 13:46:29 UTC
svn commit: r1821651 - in /httpd/httpd/trunk/server: mpm/event/event.c
mpm/worker/worker.c mpm_fdqueue.c mpm_fdqueue.h
Author: ylavic
Date: Fri Jan 19 13:46:28 2018
New Revision: 1821651
URL: http://svn.apache.org/viewvc?rev=1821651&view=rev
Log:
mpm_fdqueue: follow up to r1821624.
Be explicit in the naming about what's push/pop-ed.
Modified:
httpd/httpd/trunk/server/mpm/event/event.c
httpd/httpd/trunk/server/mpm/worker/worker.c
httpd/httpd/trunk/server/mpm_fdqueue.c
httpd/httpd/trunk/server/mpm_fdqueue.h
Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1821651&r1=1821650&r2=1821651&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Fri Jan 19 13:46:28 2018
@@ -1417,10 +1417,10 @@ static apr_status_t push2worker(event_co
csd = cs->pfd.desc.s;
ptrans = cs->p;
}
- rc = ap_queue_push(worker_queue, csd, cs, ptrans);
+ rc = ap_queue_push_socket(worker_queue, csd, cs, ptrans);
if (rc != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rc, ap_server_conf, APLOGNO(00471)
- "push2worker: ap_queue_push failed");
+ "push2worker: ap_queue_push_socket failed");
/* trash the connection; we couldn't queue the connected
* socket to a worker
*/
@@ -2319,9 +2319,9 @@ static void *APR_THREAD_FUNC worker_thre
if (APR_STATUS_IS_EOF(rv)) {
break;
}
- /* We get APR_EINTR whenever ap_queue_pop() has been interrupted
+ /* We get APR_EINTR whenever ap_queue_pop_*() has been interrupted
* from an explicit call to ap_queue_interrupt_all(). This allows
- * us to unblock threads stuck in ap_queue_pop() when a shutdown
+ * us to unblock threads stuck in ap_queue_pop_*() when a shutdown
* is pending.
*
* If workers_may_exit is set and this is ungraceful termination/
@@ -2336,7 +2336,7 @@ static void *APR_THREAD_FUNC worker_thre
/* We got some other error. */
else if (!workers_may_exit) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf,
- APLOGNO(03099) "ap_queue_pop failed");
+ APLOGNO(03099) "ap_queue_pop_socket failed");
}
continue;
}
Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1821651&r1=1821650&r2=1821651&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Fri Jan 19 13:46:28 2018
@@ -710,14 +710,14 @@ static void * APR_THREAD_FUNC listener_t
accept_mutex_error("unlock", rv, process_slot);
}
if (csd != NULL) {
- rv = ap_queue_push(worker_queue, csd, NULL, ptrans);
+ rv = ap_queue_push_socket(worker_queue, csd, NULL, ptrans);
if (rv) {
/* trash the connection; we couldn't queue the connected
* socket to a worker
*/
apr_socket_close(csd);
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(03138)
- "ap_queue_push failed");
+ "ap_queue_push_socket failed");
}
else {
have_idle_worker = 0;
@@ -807,7 +807,7 @@ worker_pop:
if (workers_may_exit) {
break;
}
- rv = ap_queue_pop(worker_queue, &csd, &ptrans);
+ rv = ap_queue_pop_socket(worker_queue, &csd, &ptrans);
if (rv != APR_SUCCESS) {
/* We get APR_EOF during a graceful shutdown once all the connections
@@ -816,9 +816,9 @@ worker_pop:
if (APR_STATUS_IS_EOF(rv)) {
break;
}
- /* We get APR_EINTR whenever ap_queue_pop() has been interrupted
+ /* We get APR_EINTR whenever ap_queue_pop_*() has been interrupted
* from an explicit call to ap_queue_interrupt_all(). This allows
- * us to unblock threads stuck in ap_queue_pop() when a shutdown
+ * us to unblock threads stuck in ap_queue_pop_*() when a shutdown
* is pending.
*
* If workers_may_exit is set and this is ungraceful termination/
@@ -833,7 +833,7 @@ worker_pop:
/* We got some other error. */
else if (!workers_may_exit) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, APLOGNO(03139)
- "ap_queue_pop failed");
+ "ap_queue_pop_socket failed");
}
continue;
}
Modified: httpd/httpd/trunk/server/mpm_fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_fdqueue.c?rev=1821651&r1=1821650&r2=1821651&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm_fdqueue.c Fri Jan 19 13:46:28 2018
@@ -215,9 +215,7 @@ apr_uint32_t ap_queue_info_num_idlers(fd
{
apr_uint32_t val;
val = apr_atomic_read32(&queue_info->idlers);
- if (val <= zero_pt)
- return 0;
- return val - zero_pt;
+ return (val > zero_pt) ? val - zero_pt : 0;
}
void ap_push_pool(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle)
@@ -349,34 +347,33 @@ static apr_status_t ap_queue_destroy(voi
/**
* Initialize the fd_queue_t.
*/
-apr_status_t ap_queue_init(fd_queue_t *queue, int queue_capacity,
- apr_pool_t *a)
+apr_status_t ap_queue_init(fd_queue_t *queue, int capacity, apr_pool_t *p)
{
int i;
apr_status_t rv;
if ((rv = apr_thread_mutex_create(&queue->one_big_mutex,
APR_THREAD_MUTEX_DEFAULT,
- a)) != APR_SUCCESS) {
+ p)) != APR_SUCCESS) {
return rv;
}
- if ((rv = apr_thread_cond_create(&queue->not_empty, a)) != APR_SUCCESS) {
+ if ((rv = apr_thread_cond_create(&queue->not_empty, p)) != APR_SUCCESS) {
return rv;
}
APR_RING_INIT(&queue->timers, timer_event_t, link);
- queue->data = apr_palloc(a, queue_capacity * sizeof(fd_queue_elem_t));
- queue->bounds = queue_capacity;
+ queue->data = apr_palloc(p, capacity * sizeof(fd_queue_elem_t));
+ queue->bounds = capacity;
queue->nelts = 0;
queue->in = 0;
queue->out = 0;
/* Set all the sockets in the queue to NULL */
- for (i = 0; i < queue_capacity; ++i)
+ for (i = 0; i < capacity; ++i)
queue->data[i].sd = NULL;
- apr_pool_cleanup_register(a, queue, ap_queue_destroy,
+ apr_pool_cleanup_register(p, queue, ap_queue_destroy,
apr_pool_cleanup_null);
return APR_SUCCESS;
@@ -388,8 +385,9 @@ apr_status_t ap_queue_init(fd_queue_t *q
* precondition: ap_queue_info_wait_for_idler has already been called
* to reserve an idle worker thread
*/
-apr_status_t ap_queue_push(fd_queue_t *queue, apr_socket_t *sd,
- void *sd_baton, apr_pool_t *p)
+apr_status_t ap_queue_push_socket(fd_queue_t *queue,
+ apr_socket_t *sd, void *sd_baton,
+ apr_pool_t *p)
{
fd_queue_elem_t *elem;
apr_status_t rv;
Modified: httpd/httpd/trunk/server/mpm_fdqueue.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_fdqueue.h?rev=1821651&r1=1821650&r2=1821651&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_fdqueue.h (original)
+++ httpd/httpd/trunk/server/mpm_fdqueue.h Fri Jan 19 13:46:28 2018
@@ -86,15 +86,15 @@ void ap_pop_pool(apr_pool_t **recycled_p
void ap_push_pool(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle);
void ap_free_idle_pools(fd_queue_info_t *queue_info);
-apr_status_t ap_queue_init(fd_queue_t *queue, int queue_capacity,
- apr_pool_t *a);
-apr_status_t ap_queue_push(fd_queue_t *queue, apr_socket_t *sd,
- void *baton, apr_pool_t *p);
+apr_status_t ap_queue_init(fd_queue_t *queue, int capacity, apr_pool_t *p);
+apr_status_t ap_queue_push_socket(fd_queue_t *queue,
+ apr_socket_t *sd, void *sd_baton,
+ apr_pool_t *p);
apr_status_t ap_queue_push_timer(fd_queue_t *queue, timer_event_t *te);
-apr_status_t ap_queue_pop_something(fd_queue_t *queue, apr_socket_t **sd,
- void **baton, apr_pool_t **p,
- timer_event_t **te);
-#define ap_queue_pop(q_, s_, p_) \
+apr_status_t ap_queue_pop_something(fd_queue_t *queue,
+ apr_socket_t **sd, void **sd_baton,
+ apr_pool_t **p, timer_event_t **te);
+#define ap_queue_pop_socket(q_, s_, p_) \
ap_queue_pop_something((q_), (s_), NULL, (p_), NULL)
apr_status_t ap_queue_interrupt_all(fd_queue_t *queue);
apr_status_t ap_queue_interrupt_one(fd_queue_t *queue);