long conn_id;
conn_rec *current_conn;
apr_pool_t *pconn;
+ apr_allocator_t *allocator;
apr_bucket_alloc_t *bucket_alloc;
worker_args_t *worker_args;
HQUEUE workq;
ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_READY,
NULL);
+ apr_allocator_create(&allocator);
+ apr_allocator_max_free_set(allocator, ap_max_mem_free);
+ bucket_alloc = apr_bucket_alloc_create_ex(allocator);
+
while (rc = DosReadQueue(workq, &rd, &len, (PPVOID)&worker_args, 0, DCWW_WAIT, &priority, NULLHANDLE),
rc == 0 && rd.ulData != WORKTYPE_EXIT) {
pconn = worker_args->pconn;
- bucket_alloc = apr_bucket_alloc_create(pconn);
ap_create_sb_handle(&sbh, pconn, child_slot, thread_slot);
current_conn = ap_run_create_connection(pconn, ap_server_conf,
worker_args->conn_sd, conn_id,
ap_update_child_status_from_indexes(child_slot, thread_slot, SERVER_DEAD,
NULL);
+
+ apr_bucket_alloc_destroy(bucket_alloc);
+ apr_allocator_destroy(allocator);
}
ap_generation_t volatile ap_my_generation=0;
/* a clean exit from a child with proper cleanup */
-static void clean_child_exit(int code, int worker_num, apr_pool_t *pthrd,
+static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans,
apr_bucket_alloc_t *bucket_alloc) __attribute__ ((noreturn));
-static void clean_child_exit(int code, int worker_num, apr_pool_t *pthrd,
+static void clean_child_exit(int code, int worker_num, apr_pool_t *ptrans,
apr_bucket_alloc_t *bucket_alloc)
{
+ apr_bucket_alloc_destroy(bucket_alloc);
if (!shutdown_pending) {
- apr_bucket_alloc_destroy(bucket_alloc);
- apr_pool_destroy(pthrd);
+ apr_pool_destroy(ptrans);
}
atomic_dec (&worker_thread_count);
void worker_main(void *arg)
{
ap_listen_rec *lr, *first_lr, *last_lr = NULL;
- apr_pool_t *ptrans, *pthrd;
+ apr_pool_t *ptrans;
apr_pool_t *pbucket;
apr_allocator_t *allocator;
apr_bucket_alloc_t *bucket_alloc;
apr_allocator_create(&allocator);
apr_allocator_max_free_set(allocator, ap_max_mem_free);
- apr_pool_create_ex(&pthrd, pmain, NULL, allocator);
- apr_allocator_owner_set(allocator, pthrd);
- apr_pool_tag(pthrd, "worker_thrd_pool");
-
- apr_pool_create(&ptrans, pthrd);
+ apr_pool_create_ex(&ptrans, pmain, NULL, allocator);
+ apr_allocator_owner_set(allocator, ptrans);
apr_pool_tag(ptrans, "transaction");
- bucket_alloc = apr_bucket_alloc_create(pthrd);
+ bucket_alloc = apr_bucket_alloc_create_ex(allocator);
atomic_inc (&worker_thread_count);
if ((ap_max_requests_per_child > 0
&& requests_this_child++ >= ap_max_requests_per_child)) {
DBPRINT1 ("\n**Thread slot %d is shutting down", my_worker_num);
- clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
+ clean_child_exit(0, my_worker_num, ptrans, bucket_alloc);
}
ap_update_child_status_from_indexes(0, my_worker_num, WORKER_READY,
for (;;) {
if (shutdown_pending || restart_pending || (ap_scoreboard_image->servers[0][my_worker_num].status == WORKER_IDLE_KILL)) {
DBPRINT1 ("\nThread slot %d is shutting down\n", my_worker_num);
- clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
+ clean_child_exit(0, my_worker_num, ptrans, bucket_alloc);
}
/* Check the listen queue on all sockets for requests */
*/
ap_log_error(APLOG_MARK, APLOG_EMERG, stat, ap_server_conf,
"apr_accept: giving up.");
- clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, pthrd,
+ clean_child_exit(APEXIT_CHILDFATAL, my_worker_num, ptrans,
bucket_alloc);
}
else {
ap_log_error(APLOG_MARK, APLOG_ERR, stat, ap_server_conf,
"apr_accept: (client socket)");
- clean_child_exit(1, my_worker_num, pthrd, bucket_alloc);
+ clean_child_exit(1, my_worker_num, ptrans, bucket_alloc);
}
}
}
}
request_count++;
}
- clean_child_exit(0, my_worker_num, pthrd, bucket_alloc);
+ clean_child_exit(0, my_worker_num, ptrans, bucket_alloc);
}
ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
- bucket_alloc = apr_bucket_alloc_create(apr_thread_pool_get(thd));
-
while (!workers_may_exit) {
if (!is_idle) {
rv = ap_queue_info_set_idle(worker_queue_info, last_ptrans);
}
is_idle = 0;
worker_sockets[thread_slot] = csd;
+ bucket_alloc = apr_bucket_alloc_create(ptrans);
process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
worker_sockets[thread_slot] = NULL;
requests_this_child--; /* FIXME: should be synchronized - aaron */
ap_update_child_status_from_indexes(process_slot, thread_slot,
(dying) ? SERVER_DEAD : SERVER_GRACEFUL, (request_rec *) NULL);
- apr_bucket_alloc_destroy(bucket_alloc);
-
apr_thread_exit(thd, APR_SUCCESS);
return NULL;
}