summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2022-01-25 18:34:57 +0100
committerYann Ylavic <ylavic@apache.org>2022-01-25 18:34:57 +0100
commit604485905718803811a4b68cd2717a3712500d4a (patch)
treee4b7c189dacd6e94365d420edb5e59d01f4b965b /modules
parentap_regex: Follow up to r1897240: #if APR_HAS_THREAD_LOCAL, not #ifdef. (diff)
downloadapache2-604485905718803811a4b68cd2717a3712500d4a.tar.xz
apache2-604485905718803811a4b68cd2717a3712500d4a.zip
core: Efficient ap_thread_current() when apr_thread_local() is missing.
#define ap_thread_create, ap_thread_current_create and ap_thread_current to their apr-1.8+ equivalent if available, or implement them using the compiler's thread_local mechanism if available, or finally provide stubs otherwise. #define AP_HAS_THREAD_LOCAL to 1 in the two former case or 0 otherwise, while AP_THREAD_LOCAL is defined to the compiler's keyword iff AP_HAS_THREAD_LOCAL. Replace all apr_thread_create() calls with ap_thread_create() so that httpd threads can use ap_thread_current()'s pool data as Thread Local Storage. Bump MMN minor. * include/httpd.h(): Define AP_HAS_THREAD_LOCAL, AP_THREAD_LOCAL (eventually), ap_thread_create(), ap_thread_current_create() and ap_thread_current(). * server/util.c: Implement ap_thread_create(), ap_thread_current_create() and ap_thread_current() when APR < 1.8. * modules/core/mod_watchdog.c, modules/http2/h2_workers.c, modules/ssl/mod_ssl_ct.c: Use ap_thread_create() instead of apr_thread_create. * server/main.c: Use AP_HAS_THREAD_LOCAL and ap_thread_current_create instead of APR's. * server/util_pcre.c: Use AP_HAS_THREAD_LOCAL and ap_thread_current instead of APR's. * server/mpm/event/event.c, server/mpm/worker/worker.c, server/mpm/prefork/prefork.c: Use ap_thread_create() instead of apr_thread_create. Create an apr_thread_t/ap_thread_current() for the main chaild thread usable at child_init(). * server/mpm/winnt/child.c: Use ap_thread_create() instead of CreateThread(). Create an apr_thread_t/ap_thread_current() for the main chaild thread usable git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897460 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules')
-rw-r--r--modules/core/mod_watchdog.c2
-rw-r--r--modules/http2/h2_workers.c4
-rw-r--r--modules/ssl/mod_ssl_ct.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/modules/core/mod_watchdog.c b/modules/core/mod_watchdog.c
index e7e05287a0..99ec7cfc4d 100644
--- a/modules/core/mod_watchdog.c
+++ b/modules/core/mod_watchdog.c
@@ -280,7 +280,7 @@ static apr_status_t wd_startup(ap_watchdog_t *w, apr_pool_t *p)
}
/* Start the newly created watchdog */
- rc = apr_thread_create(&w->thread, NULL, wd_worker, w, p);
+ rc = ap_thread_create(&w->thread, NULL, wd_worker, w, p);
if (rc == APR_SUCCESS) {
apr_pool_pre_cleanup_register(p, w, wd_worker_cleanup);
}
diff --git a/modules/http2/h2_workers.c b/modules/http2/h2_workers.c
index 8b53cf9ab4..1e7aebdca8 100644
--- a/modules/http2/h2_workers.c
+++ b/modules/http2/h2_workers.c
@@ -100,8 +100,8 @@ static apr_status_t activate_slot(h2_workers *workers, h2_slot *slot)
* to the idle queue */
apr_atomic_inc32(&workers->worker_count);
slot->timed_out = 0;
- rv = apr_thread_create(&slot->thread, workers->thread_attr,
- slot_run, slot, workers->pool);
+ rv = ap_thread_create(&slot->thread, workers->thread_attr,
+ slot_run, slot, workers->pool);
if (rv != APR_SUCCESS) {
apr_atomic_dec32(&workers->worker_count);
}
diff --git a/modules/ssl/mod_ssl_ct.c b/modules/ssl/mod_ssl_ct.c
index f583da5f18..17b673a8e5 100644
--- a/modules/ssl/mod_ssl_ct.c
+++ b/modules/ssl/mod_ssl_ct.c
@@ -1123,8 +1123,8 @@ static int daemon_thread_start(apr_pool_t *pconf, server_rec *s_main)
apr_pool_create(&pdaemon, pconf);
apr_pool_tag(pdaemon, "sct_daemon");
- rv = apr_thread_create(&daemon_thread, NULL, sct_daemon_thread, s_main,
- pconf);
+ rv = ap_thread_create(&daemon_thread, NULL, sct_daemon_thread, s_main,
+ pconf);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s_main,
APLOGNO(02709) "could not create " DAEMON_THREAD_NAME
@@ -2522,7 +2522,7 @@ static void ssl_ct_child_init(apr_pool_t *p, server_rec *s)
exit(APEXIT_CHILDSICK);
}
- rv = apr_thread_create(&service_thread, NULL, run_service_thread, s, p);
+ rv = ap_thread_create(&service_thread, NULL, run_service_thread, s, p);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
APLOGNO(02745) "could not create " SERVICE_THREAD_NAME