Apache2
mpm_fdqueue.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
25 #ifndef MPM_FDQUEUE_H
26 #define MPM_FDQUEUE_H
27 
28 #include <apr.h>
29 
30 /* This code is not AP_DECLARE()ed/exported, and used by MPMs event/worker
31  * only (for now), not worth thinking about w/o threads either...
32  */
33 #if APR_HAS_THREADS
34 
35 #include "ap_mpm.h"
36 
37 #include <apr_ring.h>
38 #include <apr_pools.h>
39 #include <apr_thread_mutex.h>
40 #include <apr_thread_cond.h>
41 #include <apr_network_io.h>
42 
43 struct fd_queue_info_t; /* opaque */
44 struct fd_queue_elem_t; /* opaque */
45 typedef struct fd_queue_info_t fd_queue_info_t;
46 typedef struct fd_queue_elem_t fd_queue_elem_t;
47 
49  apr_pool_t *pool, int max_idlers,
50  int max_recycled_pools);
52  apr_pool_t *pool_to_recycle);
55  int *had_to_block);
58 
60  apr_pool_t **recycled_pool);
62  apr_pool_t *pool_to_recycle);
64 
66 {
70  void *baton;
71  int canceled;
73 };
74 typedef struct timer_event_t timer_event_t;
75 
76 struct fd_queue_t
77 {
78  APR_RING_HEAD(timers_t, timer_event_t) timers;
80  unsigned int nelts;
81  unsigned int bounds;
82  unsigned int in;
83  unsigned int out;
86  volatile int terminated;
87 };
88 typedef struct fd_queue_t fd_queue_t;
89 
91  int capacity, apr_pool_t *p);
93  apr_socket_t *sd, void *sd_baton,
94  apr_pool_t *p);
96  timer_event_t *te);
98  apr_socket_t **sd, void **sd_baton,
99  apr_pool_t **p, timer_event_t **te);
100 #define ap_queue_pop_socket(q_, s_, p_) \
101  ap_queue_pop_something((q_), (s_), NULL, (p_), NULL)
102 
106 
107 #endif /* APR_HAS_THREADS */
108 
109 #endif /* MPM_FDQUEUE_H */
Apache Multi-Processing Module library.
APR Platform Definitions.
APR Network library.
APR memory allocation.
APR Rings.
APR Condition Variable Routines.
APR Thread Mutex Routines.
void() ap_mpm_callback_fn_t(void *baton)
Definition: ap_mpm.h:202
apr_status_t ap_queue_pop_something(fd_queue_t *queue, apr_socket_t **sd, void **sd_baton, apr_pool_t **p, timer_event_t **te)
struct fd_queue_elem_t fd_queue_elem_t
Definition: mpm_fdqueue.h:46
void ap_queue_info_free_idle_pools(fd_queue_info_t *queue_info)
apr_status_t ap_queue_info_try_get_idler(fd_queue_info_t *queue_info)
void ap_queue_info_pop_pool(fd_queue_info_t *queue_info, apr_pool_t **recycled_pool)
apr_status_t ap_queue_info_create(fd_queue_info_t **queue_info, apr_pool_t *pool, int max_idlers, int max_recycled_pools)
apr_status_t ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info, int *had_to_block)
apr_status_t ap_queue_interrupt_all(fd_queue_t *queue)
apr_status_t ap_queue_push_timer(fd_queue_t *queue, timer_event_t *te)
apr_status_t ap_queue_info_set_idle(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle)
apr_status_t ap_queue_create(fd_queue_t **pqueue, int capacity, apr_pool_t *p)
void ap_queue_info_push_pool(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle)
apr_status_t ap_queue_info_term(fd_queue_info_t *queue_info)
apr_status_t ap_queue_term(fd_queue_t *queue)
apr_uint32_t ap_queue_info_num_idlers(fd_queue_info_t *queue_info)
struct fd_queue_info_t fd_queue_info_t
Definition: mpm_fdqueue.h:45
apr_status_t ap_queue_interrupt_one(fd_queue_t *queue)
apr_status_t ap_queue_push_socket(fd_queue_t *queue, apr_socket_t *sd, void *sd_baton, apr_pool_t *p)
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:557
int apr_status_t
Definition: apr_errno.h:44
unsigned int apr_uint32_t
Definition: apr.h:348
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
apr_int64_t apr_time_t
Definition: apr_time.h:45
#define AP_DECLARE(x)
Definition: macros.h:1
Definition: apr_tables.h:62
Definition: apr_arch_networkio.h:37
Definition: apr_arch_thread_cond.h:34
Definition: apr_arch_thread_mutex.h:28
Definition: mpm_fdqueue.h:77
unsigned int nelts
Definition: mpm_fdqueue.h:80
unsigned int in
Definition: mpm_fdqueue.h:82
volatile int terminated
Definition: mpm_fdqueue.h:86
unsigned int bounds
Definition: mpm_fdqueue.h:81
apr_thread_cond_t * not_empty
Definition: mpm_fdqueue.h:85
APR_RING_HEAD(timers_t, timer_event_t) timers
apr_thread_mutex_t * one_big_mutex
Definition: mpm_fdqueue.h:84
unsigned int out
Definition: mpm_fdqueue.h:83
fd_queue_elem_t * data
Definition: mpm_fdqueue.h:79
Definition: mpm_fdqueue.h:66
ap_mpm_callback_fn_t * cbfunc
Definition: mpm_fdqueue.h:69
apr_time_t when
Definition: mpm_fdqueue.h:68
APR_RING_ENTRY(timer_event_t) link
void * baton
Definition: mpm_fdqueue.h:70
apr_array_header_t * pfds
Definition: mpm_fdqueue.h:72
int canceled
Definition: mpm_fdqueue.h:71
apr_pool_t * p