Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 */
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 {
67  APR_RING_ENTRY(timer_event_t) link;
70  void *baton;
71  int canceled;
73 };
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;
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 */
110 
void * baton
Definition: mpm_fdqueue.h:70
apr_status_t ap_queue_interrupt_all(fd_queue_t *queue)
APR Network library.
apr_thread_mutex_t * one_big_mutex
Definition: mpm_fdqueue.h:84
void( ap_mpm_callback_fn_t)(void *baton)
Definition: ap_mpm.h:208
Definition: apr_arch_thread_mutex.h:28
Definition: apr_tables.h:62
int terminated
Definition: mpm_fdqueue.h:86
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:555
apr_status_t ap_queue_info_term(fd_queue_info_t *queue_info)
#define AP_DECLARE(x)
Definition: macros.h:1
apr_uint32_t ap_queue_info_num_idlers(fd_queue_info_t *queue_info)
void ap_queue_info_free_idle_pools(fd_queue_info_t *queue_info)
apr_status_t ap_queue_push_timer(fd_queue_t *queue, timer_event_t *te)
void ap_queue_info_push_pool(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle)
apr_status_t ap_queue_info_set_idle(fd_queue_info_t *queue_info, apr_pool_t *pool_to_recycle)
void ap_queue_info_pop_pool(fd_queue_info_t *queue_info, apr_pool_t **recycled_pool)
Definition: mpm_fdqueue.h:76
apr_thread_cond_t * not_empty
Definition: mpm_fdqueue.h:85
APR Thread Mutex Routines.
Definition: mpm_fdqueue.h:65
apr_status_t ap_queue_term(fd_queue_t *queue)
apr_time_t when
Definition: mpm_fdqueue.h:68
struct fd_queue_elem_t fd_queue_elem_t
Definition: mpm_fdqueue.h:46
ap_mpm_callback_fn_t * cbfunc
Definition: mpm_fdqueue.h:69
apr_int64_t apr_time_t
Definition: apr_time.h:45
fd_queue_elem_t * data
Definition: mpm_fdqueue.h:79
APR memory allocation.
unsigned int out
Definition: mpm_fdqueue.h:83
Definition: apr_arch_networkio.h:37
apr_status_t ap_queue_interrupt_one(fd_queue_t *queue)
apr_status_t ap_queue_create(fd_queue_t **pqueue, int capacity, apr_pool_t *p)
unsigned int apr_uint32_t
Definition: apr.h:347
APR Platform Definitions.
int canceled
Definition: mpm_fdqueue.h:71
APR Condition Variable Routines.
apr_array_header_t * pfds
Definition: mpm_fdqueue.h:72
unsigned int in
Definition: mpm_fdqueue.h:82
apr_pool_t * p
apr_status_t ap_queue_push_socket(fd_queue_t *queue, apr_socket_t *sd, void *sd_baton, apr_pool_t *p)
unsigned int nelts
Definition: mpm_fdqueue.h:80
apr_status_t ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info, int *had_to_block)
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)
Apache Multi-Processing Module library.
unsigned int bounds
Definition: mpm_fdqueue.h:81
struct fd_queue_info_t fd_queue_info_t
Definition: mpm_fdqueue.h:45
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
Definition: apr_arch_thread_cond.h:34
apr_status_t ap_queue_info_create(fd_queue_info_t **queue_info, apr_pool_t *pool, int max_idlers, int max_recycled_pools)
#define APR_RING_ENTRY(elem)
Definition: apr_ring.h:70
APR_RING_HEAD(timers_t, timer_event_t) timers
apr_status_t ap_queue_info_try_get_idler(fd_queue_info_t *queue_info)
APR Rings.