Apache2
h2_workers.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct h2_workers h2_workers
 
typedef struct ap_conn_producer_t ap_conn_producer_t
 
typedef conn_recap_conn_producer_next(void *baton, int *pmore)
 
typedef void ap_conn_producer_done(void *baton, conn_rec *conn)
 
typedef void ap_conn_producer_shutdown(void *baton, int graceful)
 

Functions

h2_workersh2_workers_create (server_rec *s, apr_pool_t *pool, int max_slots, int min_active, apr_time_t idle_limit)
 
void h2_workers_shutdown (h2_workers *workers, int graceful)
 
apr_uint32_t h2_workers_get_max_workers (h2_workers *workers)
 
ap_conn_producer_th2_workers_register (h2_workers *workers, apr_pool_t *producer_pool, const char *name, ap_conn_producer_next *fn_next, ap_conn_producer_done *fn_done, ap_conn_producer_shutdown *fn_shutdown, void *baton)
 
apr_status_t h2_workers_join (h2_workers *workers, ap_conn_producer_t *producer)
 
apr_status_t h2_workers_activate (h2_workers *workers, ap_conn_producer_t *producer)
 

Typedef Documentation

◆ ap_conn_producer_done

typedef void ap_conn_producer_done(void *baton, conn_rec *conn)

Tell the producer that processing the connection is done.

Parameters
batonvalue from producer registration
connthe connection that has been processed.

◆ ap_conn_producer_next

typedef conn_rec* ap_conn_producer_next(void *baton, int *pmore)

Ask a producer for the next connection to process.

Parameters
batonvalue from producer registration
pconnholds the connection to process on return
pmoreif the producer has more connections that may be retrieved
Returns
APR_SUCCESS for a connection to process, APR_EAGAIN for no connection being available at the time.

◆ ap_conn_producer_shutdown

typedef void ap_conn_producer_shutdown(void *baton, int graceful)

Tell the producer that the workers are shutting down.

Parameters
batonvalue from producer registration
graceful!= 0 iff shutdown is graceful

◆ ap_conn_producer_t

ap_conn_producer_t is the source of connections (conn_rec*) to run.

Active producers are queried by idle workers for connections. If they do not hand one back, they become inactive and are not queried further. h2_workers_activate() places them on the active list again.

A producer finishing MUST call h2_workers_join() which removes it completely from workers processing and waits for all ongoing work for this producer to be done.

◆ h2_workers

typedef struct h2_workers h2_workers

Function Documentation

◆ h2_workers_activate()

apr_status_t h2_workers_activate ( h2_workers workers,
ap_conn_producer_t producer 
)

Activate a producer. A worker will query the producer for a connection to process, once a worker is available. This may be called, irregardless of the producers active/inactive.

◆ h2_workers_create()

h2_workers* h2_workers_create ( server_rec s,
apr_pool_t pool,
int  max_slots,
int  min_active,
apr_time_t  idle_limit 
)

Create a worker set with a maximum number of 'slots', e.g. worker threads to run. Always keep min_active workers running. Shutdown any additional workers after idle_secs seconds of doing nothing.

@oaram s the base server

Parameters
poolfor allocations
min_activeminimum number of workers to run
max_slotsmaximum number of worker slots
idle_limitupper duration of idle after a non-minimal slots shuts down

◆ h2_workers_get_max_workers()

apr_uint32_t h2_workers_get_max_workers ( h2_workers workers)

Get the maximum number of workers.

◆ h2_workers_join()

apr_status_t h2_workers_join ( h2_workers workers,
ap_conn_producer_t producer 
)

Stop retrieving more connection from the producer and wait for all ongoing for from that producer to be done.

◆ h2_workers_register()

ap_conn_producer_t* h2_workers_register ( h2_workers workers,
apr_pool_t producer_pool,
const char *  name,
ap_conn_producer_next fn_next,
ap_conn_producer_done fn_done,
ap_conn_producer_shutdown fn_shutdown,
void *  baton 
)

Register a new producer with the given baton and callback functions. Will allocate internal structures from the given pool (but make no use of the pool after registration). Producers are inactive on registration. See h2_workers_activate().

Parameters
producer_poolto allocate the producer from
namedescriptive name of the producer, must not be unique
fn_nextcallback for retrieving connections to process
fn_donecallback for processed connections
batonprovided value passed on in callbacks
Returns
the producer instance created

◆ h2_workers_shutdown()

void h2_workers_shutdown ( h2_workers workers,
int  graceful 
)

Shut down processing.