diff options
author | Yann Ylavic <ylavic@apache.org> | 2022-01-25 18:34:57 +0100 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2022-01-25 18:34:57 +0100 |
commit | 604485905718803811a4b68cd2717a3712500d4a (patch) | |
tree | e4b7c189dacd6e94365d420edb5e59d01f4b965b /server/util_pcre.c | |
parent | ap_regex: Follow up to r1897240: #if APR_HAS_THREAD_LOCAL, not #ifdef. (diff) | |
download | apache2-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 'server/util_pcre.c')
-rw-r--r-- | server/util_pcre.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/util_pcre.c b/server/util_pcre.c index 0e48448b67..68224e7cbf 100644 --- a/server/util_pcre.c +++ b/server/util_pcre.c @@ -269,7 +269,7 @@ AP_DECLARE(int) ap_regcomp(ap_regex_t * preg, const char *pattern, int cflags) * context per thread (in Thread Local Storage, TLS) grown as needed, and while * at it we do the same for PCRE1 ints vectors. Note that this requires a fast * TLS mechanism to be worth it, which is the case of apr_thread_data_get/set() - * from/to apr_thread_current() when APR_HAS_THREAD_LOCAL; otherwise we'll do + * from/to ap_thread_current() when AP_HAS_THREAD_LOCAL; otherwise we'll do * the allocation and freeing for each ap_regexec(). */ @@ -318,7 +318,7 @@ void free_match_data(match_data_pt data, apr_size_t size) #endif } -#if APR_HAS_THREAD_LOCAL +#if AP_HAS_THREAD_LOCAL struct apreg_tls { match_data_pt data; @@ -342,10 +342,10 @@ static match_data_pt get_match_data(apr_size_t size, apr_thread_t *current; struct apreg_tls *tls = NULL; - /* Even though APR_HAS_THREAD_LOCAL, we may still be called by a + /* Even though AP_HAS_THREAD_LOCAL, we may still be called by a * native/non-apr thread, let's fall back to alloc/free in this case. */ - current = apr_thread_current(); + current = ap_thread_current(); if (!current) { *to_free = 1; return alloc_match_data(size, ovector, small_vector); @@ -391,7 +391,7 @@ static match_data_pt get_match_data(apr_size_t size, return tls->data; } -#else /* !APR_HAS_THREAD_LOCAL */ +#else /* !AP_HAS_THREAD_LOCAL */ static APR_INLINE match_data_pt get_match_data(apr_size_t size, match_vector_pt *ovector, @@ -402,7 +402,7 @@ static APR_INLINE match_data_pt get_match_data(apr_size_t size, return alloc_match_data(size, ovector, small_vector); } -#endif /* !APR_HAS_THREAD_LOCAL */ +#endif /* !AP_HAS_THREAD_LOCAL */ AP_DECLARE(int) ap_regexec(const ap_regex_t *preg, const char *string, apr_size_t nmatch, ap_regmatch_t *pmatch, |