|
Packit |
90a5c9 |
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
* contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
* this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
* (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
* the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
* See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
* limitations under the License.
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifndef __mod_h2__h2_workers__
|
|
Packit |
90a5c9 |
#define __mod_h2__h2_workers__
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Thread pool specific to executing h2_tasks. Has a minimum and maximum
|
|
Packit |
90a5c9 |
* number of workers it creates. Starts with minimum workers and adds
|
|
Packit |
90a5c9 |
* some on load, reduces the number again when idle.
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
struct apr_thread_mutex_t;
|
|
Packit |
90a5c9 |
struct apr_thread_cond_t;
|
|
Packit |
90a5c9 |
struct h2_mplx;
|
|
Packit |
90a5c9 |
struct h2_request;
|
|
Packit |
90a5c9 |
struct h2_task;
|
|
Packit |
90a5c9 |
struct h2_fifo;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct h2_slot;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
typedef struct h2_workers h2_workers;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct h2_workers {
|
|
Packit |
90a5c9 |
server_rec *s;
|
|
Packit |
90a5c9 |
apr_pool_t *pool;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
int next_worker_id;
|
|
Packit |
90a5c9 |
int min_workers;
|
|
Packit |
90a5c9 |
int max_workers;
|
|
Packit |
90a5c9 |
int max_idle_secs;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
int aborted;
|
|
Packit |
90a5c9 |
int dynamic;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
apr_threadattr_t *thread_attr;
|
|
Packit |
90a5c9 |
int nslots;
|
|
Packit |
90a5c9 |
struct h2_slot *slots;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
volatile apr_uint32_t worker_count;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct h2_slot *free;
|
|
Packit |
90a5c9 |
struct h2_slot *idle;
|
|
Packit |
90a5c9 |
struct h2_slot *zombies;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct h2_fifo *mplxs;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct apr_thread_mutex_t *lock;
|
|
Packit |
90a5c9 |
};
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Create a worker pool with the given minimum and maximum number of
|
|
Packit |
90a5c9 |
* threads.
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
h2_workers *h2_workers_create(server_rec *s, apr_pool_t *pool,
|
|
Packit |
90a5c9 |
int min_size, int max_size, int idle_secs);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Registers a h2_mplx for task scheduling. If this h2_mplx runs
|
|
Packit |
90a5c9 |
* out of tasks, it will be automatically be unregistered. Should
|
|
Packit |
90a5c9 |
* new tasks arrive, it needs to be registered again.
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
apr_status_t h2_workers_register(h2_workers *workers, struct h2_mplx *m);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Remove a h2_mplx from the worker registry.
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
apr_status_t h2_workers_unregister(h2_workers *workers, struct h2_mplx *m);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#endif /* defined(__mod_h2__h2_workers__) */
|