]> git.ipfire.org Git - thirdparty/apache/httpd.git/commit
core: Efficient ap_thread_current() when apr_thread_local() is missing.
authorYann Ylavic <ylavic@apache.org>
Tue, 25 Jan 2022 17:34:57 +0000 (17:34 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 25 Jan 2022 17:34:57 +0000 (17:34 +0000)
commit604485905718803811a4b68cd2717a3712500d4a
treee4b7c189dacd6e94365d420edb5e59d01f4b965b
parenta6f105f7d4451f64b98cff16804a0158ddd29bff
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
12 files changed:
include/ap_mmn.h
include/httpd.h
modules/core/mod_watchdog.c
modules/http2/h2_workers.c
modules/ssl/mod_ssl_ct.c
server/main.c
server/mpm/event/event.c
server/mpm/prefork/prefork.c
server/mpm/winnt/child.c
server/mpm/worker/worker.c
server/util.c
server/util_pcre.c