UniMRCP  1.7.0
apt_timer_queue.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 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 
17 #ifndef APT_TIMER_QUEUE_H
18 #define APT_TIMER_QUEUE_H
19 
20 /**
21  * @file apt_timer_queue.h
22  * @brief Timer Queue
23  */
24 
25 #include "apt.h"
26 
28 
29 /** Opaque timer declaration */
30 typedef struct apt_timer_t apt_timer_t;
31 /** Opaque timer queue declaration */
33 
34 /** Prototype of timer callback */
35 typedef void (*apt_timer_proc_f)(apt_timer_t *timer, void *obj);
36 
37 
38 /** Create timer queue */
40 
41 /** Destroy timer queue */
43 
44 /** Advance scheduled timers */
45 APT_DECLARE(void) apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time);
46 
47 /** Is timer queue empty */
49 
50 /** Get current timeout */
51 APT_DECLARE(apt_bool_t) apt_timer_queue_timeout_get(apt_timer_queue_t *timer_queue, apr_uint32_t *timeout);
52 
53 
54 /** Create timer */
55 APT_DECLARE(apt_timer_t*) apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool);
56 
57 /** Set one-shot timer */
58 APT_DECLARE(apt_bool_t) apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout);
59 
60 /** Kill timer */
62 
63 
65 
66 #endif /* APT_TIMER_QUEUE_H */
apt_timer_queue_t * apt_timer_queue_create(apr_pool_t *pool)
void(* apt_timer_proc_f)(apt_timer_t *timer, void *obj)
Definition: apt_timer_queue.h:35
void apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time)
#define APT_END_EXTERN_C
Definition: apt.h:38
apt_bool_t apt_timer_queue_is_empty(const apt_timer_queue_t *timer_queue)
int apt_bool_t
Definition: apt.h:57
void apt_timer_queue_destroy(apt_timer_queue_t *timer_queue)
apt_timer_t * apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool)
struct apt_timer_queue_t apt_timer_queue_t
Definition: apt_timer_queue.h:32
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
#define APT_DECLARE(type)
Definition: apt.h:53
APR Toolkit Definitions.
apt_bool_t apt_timer_kill(apt_timer_t *timer)
apt_bool_t apt_timer_queue_timeout_get(apt_timer_queue_t *timer_queue, apr_uint32_t *timeout)
typedefAPT_BEGIN_EXTERN_C struct apt_timer_t apt_timer_t
Definition: apt_timer_queue.h:30
apt_bool_t apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout)