UniMRCP
1.3.0
Main Page
Related Pages
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
libs
apr-toolkit
include
apt_poller_task.h
Go to the documentation of this file.
1
/*
2
* Copyright 2008-2014 Arsen Chaloyan
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* 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
* $Id: apt_poller_task.h 2176 2014-09-12 05:00:23Z achaloyan@gmail.com $
17
*/
18
19
#ifndef APT_POLLER_TASK_H
20
#define APT_POLLER_TASK_H
21
22
/**
23
* @file apt_poller_task.h
24
* @brief Poller Task
25
*/
26
27
#include "
apt_pollset.h
"
28
#include "
apt_task.h
"
29
#include "
apt_timer_queue.h
"
30
31
APT_BEGIN_EXTERN_C
32
33
/** Opaque poller task declaration */
34
typedef
struct
apt_poller_task_t
apt_poller_task_t
;
35
36
/** Function prototype to handle signalled descripors */
37
typedef
apt_bool_t
(*
apt_poll_signal_f
)(
void
*obj,
const
apr_pollfd_t *descriptor);
38
39
40
/**
41
* Create poller task.
42
* @param max_pollset_size the maximum number of descriptors pollset can hold
43
* @param signal_handler the handler of signalled descriptors
44
* @param obj the external object to pass to callback
45
* @param msg_pool the pool of task messages
46
* @param pool the pool to allocate memory from
47
*/
48
APT_DECLARE
(
apt_poller_task_t
*)
apt_poller_task_create
(
49
apr_size_t max_pollset_size,
50
apt_poll_signal_f
signal_handler,
51
void
*obj,
52
apt_task_msg_pool_t
*msg_pool,
53
apr_pool_t *pool);
54
55
/**
56
* Destroy poller task.
57
* @param task the task to destroy
58
*/
59
APT_DECLARE
(
apt_bool_t
)
apt_poller_task_destroy
(
apt_poller_task_t
*task);
60
61
/**
62
* Cleanup poller task.
63
* @param task the task to cleanup
64
*
65
* @remark This function should be considered in protected scope.
66
* It will be called on task destroy unless you override the behavior.
67
*/
68
APT_DECLARE
(
void
)
apt_poller_task_cleanup
(
apt_poller_task_t
*task);
69
70
/**
71
* Start poller task and wait for incoming messages.
72
* @param task the task to start
73
*/
74
APT_DECLARE
(
apt_bool_t
)
apt_poller_task_start
(
apt_poller_task_t
*task);
75
76
/**
77
* Terminate poller task.
78
* @param task the task to terminate
79
*/
80
APT_DECLARE
(
apt_bool_t
)
apt_poller_task_terminate
(
apt_poller_task_t
*task);
81
82
/**
83
* Get task base.
84
* @param task the poller task to get task base from
85
*/
86
APT_DECLARE
(
apt_task_t
*)
apt_poller_task_base_get
(const
apt_poller_task_t
*task);
87
88
/**
89
* Get task vtable.
90
* @param task the poller task to get vtable from
91
*/
92
APT_DECLARE
(
apt_task_vtable_t
*)
apt_poller_task_vtable_get
(const
apt_poller_task_t
*task);
93
94
/**
95
* Get external object.
96
* @param task the poller task to get object from
97
*/
98
APT_DECLARE
(
void
*)
apt_poller_task_object_get
(const
apt_poller_task_t
*task);
99
100
/**
101
* Add descriptor to pollset.
102
* @param task the task which holds the pollset
103
* @param descriptor the descriptor to add
104
*/
105
APT_DECLARE
(
apt_bool_t
)
apt_poller_task_descriptor_add
(const
apt_poller_task_t
*task, const apr_pollfd_t *descriptor);
106
107
/**
108
* Remove descriptor from pollset.
109
* @param task the task which holds the pollset
110
* @param descriptor the descriptor to remove
111
*/
112
APT_DECLARE
(
apt_bool_t
)
apt_poller_task_descriptor_remove
(const
apt_poller_task_t
*task, const apr_pollfd_t *descriptor);
113
114
/**
115
* Create timer.
116
* @param task the poller task to create timer in the scope of
117
* @param proc the timer callback
118
* @param obj the object to pass to callback
119
* @param pool the pool to allocate memory from
120
*/
121
APT_DECLARE
(
apt_timer_t
*)
apt_poller_task_timer_create
(
122
apt_poller_task_t
*task,
123
apt_timer_proc_f
proc,
124
void
*obj,
125
apr_pool_t *pool);
126
127
128
APT_END_EXTERN_C
129
130
#endif
/* APT_POLLER_TASK_H */
Generated on Mon Feb 2 2015 19:41:38 for UniMRCP by
1.8.3.1