|
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 |
/**
|
|
Packit |
90a5c9 |
* @file server/mpm_fdqueue.h
|
|
Packit |
90a5c9 |
* @brief fd queue declarations
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* @addtogroup APACHE_MPM_EVENT
|
|
Packit |
90a5c9 |
* @{
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#ifndef MPM_FDQUEUE_H
|
|
Packit |
90a5c9 |
#define MPM_FDQUEUE_H
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#include <apr.h>
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* This code is not AP_DECLARE()ed/exported, and used by MPMs event/worker
|
|
Packit |
90a5c9 |
* only (for now), not worth thinking about w/o threads either...
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#if APR_HAS_THREADS
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#include "ap_mpm.h"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#include <apr_ring.h>
|
|
Packit |
90a5c9 |
#include <apr_pools.h>
|
|
Packit |
90a5c9 |
#include <apr_thread_mutex.h>
|
|
Packit |
90a5c9 |
#include <apr_thread_cond.h>
|
|
Packit |
90a5c9 |
#include <apr_network_io.h>
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct fd_queue_info_t; /* opaque */
|
|
Packit |
90a5c9 |
struct fd_queue_elem_t; /* opaque */
|
|
Packit |
90a5c9 |
typedef struct fd_queue_info_t fd_queue_info_t;
|
|
Packit |
90a5c9 |
typedef struct fd_queue_elem_t fd_queue_elem_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_info_create(fd_queue_info_t **queue_info,
|
|
Packit |
90a5c9 |
apr_pool_t *pool, int max_idlers,
|
|
Packit |
90a5c9 |
int max_recycled_pools);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_info_set_idle(fd_queue_info_t *queue_info,
|
|
Packit |
90a5c9 |
apr_pool_t *pool_to_recycle);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_info_try_get_idler(fd_queue_info_t *queue_info);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info,
|
|
Packit |
90a5c9 |
int *had_to_block);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_uint32_t) ap_queue_info_num_idlers(fd_queue_info_t *queue_info);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_info_term(fd_queue_info_t *queue_info);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(void) ap_queue_info_pop_pool(fd_queue_info_t *queue_info,
|
|
Packit |
90a5c9 |
apr_pool_t **recycled_pool);
|
|
Packit |
90a5c9 |
AP_DECLARE(void) ap_queue_info_push_pool(fd_queue_info_t *queue_info,
|
|
Packit |
90a5c9 |
apr_pool_t *pool_to_recycle);
|
|
Packit |
90a5c9 |
AP_DECLARE(void) ap_queue_info_free_idle_pools(fd_queue_info_t *queue_info);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct timer_event_t
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
APR_RING_ENTRY(timer_event_t) link;
|
|
Packit |
90a5c9 |
apr_time_t when;
|
|
Packit |
90a5c9 |
ap_mpm_callback_fn_t *cbfunc;
|
|
Packit |
90a5c9 |
void *baton;
|
|
Packit |
90a5c9 |
int canceled;
|
|
Packit |
90a5c9 |
apr_array_header_t *remove;
|
|
Packit |
90a5c9 |
};
|
|
Packit |
90a5c9 |
typedef struct timer_event_t timer_event_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
struct fd_queue_t
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
APR_RING_HEAD(timers_t, timer_event_t) timers;
|
|
Packit |
90a5c9 |
fd_queue_elem_t *data;
|
|
Packit |
90a5c9 |
unsigned int nelts;
|
|
Packit |
90a5c9 |
unsigned int bounds;
|
|
Packit |
90a5c9 |
unsigned int in;
|
|
Packit |
90a5c9 |
unsigned int out;
|
|
Packit |
90a5c9 |
apr_thread_mutex_t *one_big_mutex;
|
|
Packit |
90a5c9 |
apr_thread_cond_t *not_empty;
|
|
Packit |
90a5c9 |
int terminated;
|
|
Packit |
90a5c9 |
};
|
|
Packit |
90a5c9 |
typedef struct fd_queue_t fd_queue_t;
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_create(fd_queue_t **pqueue,
|
|
Packit |
90a5c9 |
int capacity, apr_pool_t *p);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_push_socket(fd_queue_t *queue,
|
|
Packit |
90a5c9 |
apr_socket_t *sd, void *sd_baton,
|
|
Packit |
90a5c9 |
apr_pool_t *p);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_push_timer(fd_queue_t *queue,
|
|
Packit |
90a5c9 |
timer_event_t *te);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_pop_something(fd_queue_t *queue,
|
|
Packit |
90a5c9 |
apr_socket_t **sd, void **sd_baton,
|
|
Packit |
90a5c9 |
apr_pool_t **p, timer_event_t **te);
|
|
Packit |
90a5c9 |
#define ap_queue_pop_socket(q_, s_, p_) \
|
|
Packit |
90a5c9 |
ap_queue_pop_something((q_), (s_), NULL, (p_), NULL)
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_interrupt_all(fd_queue_t *queue);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_interrupt_one(fd_queue_t *queue);
|
|
Packit |
90a5c9 |
AP_DECLARE(apr_status_t) ap_queue_term(fd_queue_t *queue);
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#endif /* APR_HAS_THREADS */
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#endif /* MPM_FDQUEUE_H */
|
|
Packit |
90a5c9 |
/** @} */
|