diff options
Diffstat (limited to 'include/httpd.h')
-rw-r--r-- | include/httpd.h | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/include/httpd.h b/include/httpd.h index a4c32535c7..1ef00212f4 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -2571,27 +2571,35 @@ AP_DECLARE(void *) ap_realloc(void *ptr, size_t size) #if APR_HAS_THREADS -#if APR_VERSION_AT_LEAST(1,8,0) && !defined(AP_NO_THREAD_LOCAL) +/* apr_thread_create() wrapper that handles thread pool limits and + * ap_thread_current() eventually (if not handle by APR already). + */ +AP_DECLARE(apr_status_t) ap_thread_create(apr_thread_t **thread, + apr_threadattr_t *attr, + apr_thread_start_t func, + void *data, apr_pool_t *pool); + +/* Make the main() thread ap_thread_current()-able. */ +AP_DECLARE(apr_status_t) ap_thread_main_create(apr_thread_t **thread, + apr_pool_t *pool); + +#if APR_VERSION_AT_LEAST(1,8,0) /** - * APR 1.8+ implement those already. + * Use APR 1.8+ implementation. */ -#if APR_HAS_THREAD_LOCAL -#define AP_HAS_THREAD_LOCAL 1 -#define AP_THREAD_LOCAL APR_THREAD_LOCAL -#else -#define AP_HAS_THREAD_LOCAL 0 +#if APR_HAS_THREAD_LOCAL && !defined(AP_NO_THREAD_LOCAL) +#define AP_THREAD_LOCAL APR_THREAD_LOCAL #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_current_after_fork apr_thread_current_after_fork -#else /* APR_VERSION_AT_LEAST(1,8,0) && !defined(AP_NO_THREAD_LOCAL) */ +#else /* APR_VERSION_AT_LEAST(1,8,0) */ -#ifndef AP_NO_THREAD_LOCAL +#if !defined(AP_NO_THREAD_LOCAL) /** - * AP_THREAD_LOCAL keyword mapping the compiler's. + * AP_THREAD_LOCAL keyword aliases the compiler's. */ #if defined(__cplusplus) && __cplusplus >= 201103L #define AP_THREAD_LOCAL thread_local @@ -2604,18 +2612,7 @@ AP_DECLARE(void *) ap_realloc(void *ptr, size_t size) #elif defined(WIN32) && defined(_MSC_VER) #define AP_THREAD_LOCAL __declspec(thread) #endif -#endif /* ndef AP_NO_THREAD_LOCAL */ - -#ifndef AP_THREAD_LOCAL -#define AP_HAS_THREAD_LOCAL 0 -#define ap_thread_create apr_thread_create -#else /* AP_THREAD_LOCAL */ -#define AP_HAS_THREAD_LOCAL 1 -AP_DECLARE(apr_status_t) ap_thread_create(apr_thread_t **thread, - apr_threadattr_t *attr, - apr_thread_start_t func, - void *data, apr_pool_t *pool); -#endif /* AP_THREAD_LOCAL */ +#endif /* !defined(AP_NO_THREAD_LOCAL) */ AP_DECLARE(apr_status_t) ap_thread_current_create(apr_thread_t **current, apr_threadattr_t *attr, @@ -2623,16 +2620,15 @@ AP_DECLARE(apr_status_t) ap_thread_current_create(apr_thread_t **current, 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) && !defined(AP_NO_THREAD_LOCAL) */ - -AP_DECLARE(apr_status_t) ap_thread_main_create(apr_thread_t **thread, - apr_pool_t *pool); +#endif /* APR_VERSION_AT_LEAST(1,8,0) */ -#else /* APR_HAS_THREADS */ +#endif /* APR_HAS_THREADS */ +#ifdef AP_THREAD_LOCAL +#define AP_HAS_THREAD_LOCAL 1 +#else #define AP_HAS_THREAD_LOCAL 0 - -#endif /* APR_HAS_THREADS */ +#endif /** * Get server load params |