diff options
author | Yann Ylavic <ylavic@apache.org> | 2022-01-25 20:28:28 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2022-01-25 20:28:28 +0000 |
commit | aa95fe54f45cbd518a1d53bf9eda5cf17acc37f4 (patch) | |
tree | f944de6e1c4546f48662ed01956ee9dce571adfe /include | |
parent | 15cf51108fe054a74c6b5846f81927725db16027 (diff) | |
download | httpd-aa95fe54f45cbd518a1d53bf9eda5cf17acc37f4.tar.gz |
core: Follow up to r1897460: Implement and use ap_thread_current_after_fork().
thread_local variables are not (always?) reset on fork(), so we need a way
to set the current_thread to NULL in the child process.
Implement and use ap_thread_current_after_fork() for that.
* include/httpd.h:
Define ap_thread_current_after_fork().
* server/util.c:
Implement ap_thread_current_after_fork().
* server/mpm/event/event.c, server/mpm/prefork/prefork.c,
server/mpm/worker/worker.c:
Use ap_thread_current_after_fork().
* server/mpm/winnt/child.c:
Windows processes are not fork()ed and each child runs the main(), so
ap_thread_current_create() was already called there.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897472 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/httpd.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/include/httpd.h b/include/httpd.h index 103e04921b..419314fe31 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -2572,14 +2572,15 @@ AP_DECLARE(void *) ap_realloc(void *ptr, size_t size) * APR 1.8+ implement those already. */ #if APR_HAS_THREAD_LOCAL -#define AP_HAS_THREAD_LOCAL 1 -#define AP_THREAD_LOCAL APR_THREAD_LOCAL +#define AP_HAS_THREAD_LOCAL 1 +#define AP_THREAD_LOCAL APR_THREAD_LOCAL #else -#define AP_HAS_THREAD_LOCAL 0 +#define AP_HAS_THREAD_LOCAL 0 #endif -#define ap_thread_create apr_thread_create -#define ap_thread_current apr_thread_current -#define ap_thread_current_create apr_thread_current_create +#define ap_thread_create apr_thread_create +#define ap_thread_current apr_thread_current +#define ap_thread_current_create apr_thread_current_create +#define ap_thread_current_after_fork apr_thread_current_after_fork #else /* !APR_VERSION_AT_LEAST(1,8,0) */ @@ -2609,6 +2610,7 @@ AP_DECLARE(apr_status_t) ap_thread_create(apr_thread_t **thread, AP_DECLARE(apr_status_t) ap_thread_current_create(apr_thread_t **current, apr_threadattr_t *attr, apr_pool_t *pool); +AP_DECLARE(void) ap_thread_current_after_fork(void); AP_DECLARE(apr_thread_t *) ap_thread_current(void); #endif /* !APR_VERSION_AT_LEAST(1,8,0) */ |