summaryrefslogtreecommitdiffstats
path: root/server/mpm/winnt/child.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/mpm/winnt/child.c')
-rw-r--r--server/mpm/winnt/child.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c
index 21755f3..05151a8 100644
--- a/server/mpm/winnt/child.c
+++ b/server/mpm/winnt/child.c
@@ -352,7 +352,7 @@ static unsigned int __stdcall winnt_accept(void *lr_)
ap_listen_rec *lr = (ap_listen_rec *)lr_;
apr_os_sock_info_t sockinfo;
winnt_conn_ctx_t *context = NULL;
- DWORD BytesRead;
+ DWORD BytesRead = 0;
SOCKET nlsd;
LPFN_ACCEPTEX lpfnAcceptEx = NULL;
LPFN_GETACCEPTEXSOCKADDRS lpfnGetAcceptExSockaddrs = NULL;
@@ -784,8 +784,8 @@ static winnt_conn_ctx_t *winnt_get_connection(winnt_conn_ctx_t *context)
*/
static DWORD __stdcall worker_main(void *thread_num_val)
{
- apr_thread_t *thd;
- apr_os_thread_t osthd;
+ apr_thread_t *thd = NULL;
+ apr_os_thread_t osthd = NULL;
static int requests_this_child = 0;
winnt_conn_ctx_t *context = NULL;
int thread_num = (int)thread_num_val;
@@ -793,7 +793,16 @@ static DWORD __stdcall worker_main(void *thread_num_val)
conn_rec *c;
apr_int32_t disconnected;
+#if AP_HAS_THREAD_LOCAL
+ if (ap_thread_current_create(&thd, NULL, pchild) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf, APLOGNO(10376)
+ "Couldn't initialize worker thread, thread locals won't "
+ "be available");
+ osthd = apr_os_thread_current();
+ }
+#else
osthd = apr_os_thread_current();
+#endif
while (1) {
@@ -826,8 +835,10 @@ static DWORD __stdcall worker_main(void *thread_num_val)
continue;
}
- thd = NULL;
- apr_os_thread_put(&thd, &osthd, context->ptrans);
+ if (osthd) {
+ thd = NULL;
+ apr_os_thread_put(&thd, &osthd, context->ptrans);
+ }
c->current_thread = thd;
ap_process_connection(c, context->sock);
@@ -842,6 +853,12 @@ static DWORD __stdcall worker_main(void *thread_num_val)
ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD, NULL);
+#if AP_HAS_THREAD_LOCAL
+ if (!osthd) {
+ apr_pool_destroy(apr_thread_pool_get(thd));
+ }
+#endif
+
return 0;
}