Skip to content

Commit

Permalink
mpm_event: Simplify pollset "good methods" vs APR_POLLSET_WAKEABLE.
Browse files Browse the repository at this point in the history
* server/mpm/event/event.c(setup_threads_runtime):
  Simplify pollset creation code.

All pollset "good methods" implement APR_POLLSET_WAKEABLE and wake-ability
is quite important for MPM event's correctness anyway so simplify code around
pollset creation so as not to suggest that APR_POLLSET_NODEFAULT if favored
against APR_POLLSET_WAKEABLE.

While at it account for the wakeup pipe in the pollset_size since not all
pollset methods seem to do it internally in APR.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916925 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ylavic committed Apr 12, 2024
1 parent a9a10f3 commit f9f742e
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions server/mpm/event/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -2630,29 +2630,27 @@ static void setup_threads_runtime(void)

/* Create the main pollset */
pollset_flags = APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY |
APR_POLLSET_NODEFAULT | APR_POLLSET_WAKEABLE;
APR_POLLSET_WAKEABLE | APR_POLLSET_NODEFAULT;
for (i = 0; i < sizeof(good_methods) / sizeof(good_methods[0]); i++) {
rv = apr_pollset_create_ex(&event_pollset, pollset_size, pruntime,
rv = apr_pollset_create_ex(&event_pollset, pollset_size + 1, pruntime,
pollset_flags, good_methods[i]);
if (rv == APR_SUCCESS) {
listener_is_wakeable = 1;
break;
}
}
if (rv != APR_SUCCESS) {
pollset_flags &= ~APR_POLLSET_WAKEABLE;
for (i = 0; i < sizeof(good_methods) / sizeof(good_methods[0]); i++) {
rv = apr_pollset_create_ex(&event_pollset, pollset_size, pruntime,
pollset_flags, good_methods[i]);
if (rv == APR_SUCCESS) {
break;
}
}
}
if (rv != APR_SUCCESS) {
pollset_flags &= ~APR_POLLSET_NODEFAULT;
rv = apr_pollset_create(&event_pollset, pollset_size, pruntime,
rv = apr_pollset_create(&event_pollset, pollset_size + 1, pruntime,
pollset_flags);
if (rv == APR_SUCCESS) {
listener_is_wakeable = 1;
}
else {
pollset_flags &= ~APR_POLLSET_WAKEABLE;
rv = apr_pollset_create(&event_pollset, pollset_size, pruntime,
pollset_flags);
}
}
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, APLOGNO(03103)
Expand Down

0 comments on commit f9f742e

Please sign in to comment.