UniMRCP  1.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Typedefs | Functions
apt_poller_task.h File Reference

Poller Task. More...

#include "apt_pollset.h"
#include "apt_task.h"
#include "apt_timer_queue.h"

Go to the source code of this file.

Typedefs

typedef
typedefAPT_BEGIN_EXTERN_C
struct apt_poller_task_t 
apt_poller_task_t
 
typedef apt_bool_t(* apt_poll_signal_f )(void *obj, const apr_pollfd_t *descriptor)
 

Functions

apt_poller_task_t * apt_poller_task_create (apr_size_t max_pollset_size, apt_poll_signal_f signal_handler, void *obj, apt_task_msg_pool_t *msg_pool, apr_pool_t *pool)
 
apt_bool_t apt_poller_task_destroy (apt_poller_task_t *task)
 
void apt_poller_task_cleanup (apt_poller_task_t *task)
 
apt_bool_t apt_poller_task_start (apt_poller_task_t *task)
 
apt_bool_t apt_poller_task_terminate (apt_poller_task_t *task)
 
apt_task_t * apt_poller_task_base_get (const apt_poller_task_t *task)
 
apt_task_vtable_t * apt_poller_task_vtable_get (const apt_poller_task_t *task)
 
void * apt_poller_task_object_get (const apt_poller_task_t *task)
 
apt_bool_t apt_poller_task_descriptor_add (const apt_poller_task_t *task, const apr_pollfd_t *descriptor)
 
apt_bool_t apt_poller_task_descriptor_remove (const apt_poller_task_t *task, const apr_pollfd_t *descriptor)
 
apt_timer_t * apt_poller_task_timer_create (apt_poller_task_t *task, apt_timer_proc_f proc, void *obj, apr_pool_t *pool)
 

Detailed Description

Poller Task.

Typedef Documentation

typedef apt_bool_t(* apt_poll_signal_f)(void *obj, const apr_pollfd_t *descriptor)

Function prototype to handle signalled descripors

typedef typedefAPT_BEGIN_EXTERN_C struct apt_poller_task_t apt_poller_task_t

Opaque poller task declaration

Function Documentation

apt_task_t* apt_poller_task_base_get ( const apt_poller_task_t *  task)

Get task base.

Parameters
taskthe poller task to get task base from
void apt_poller_task_cleanup ( apt_poller_task_t *  task)

Cleanup poller task.

Parameters
taskthe task to cleanup
Remarks
This function should be considered in protected scope. It will be called on task destroy unless you override the behavior.
apt_poller_task_t* apt_poller_task_create ( apr_size_t  max_pollset_size,
apt_poll_signal_f  signal_handler,
void *  obj,
apt_task_msg_pool_t *  msg_pool,
apr_pool_t *  pool 
)

Create poller task.

Parameters
max_pollset_sizethe maximum number of descriptors pollset can hold
signal_handlerthe handler of signalled descriptors
objthe external object to pass to callback
msg_poolthe pool of task messages
poolthe pool to allocate memory from
apt_bool_t apt_poller_task_descriptor_add ( const apt_poller_task_t *  task,
const apr_pollfd_t *  descriptor 
)

Add descriptor to pollset.

Parameters
taskthe task which holds the pollset
descriptorthe descriptor to add
apt_bool_t apt_poller_task_descriptor_remove ( const apt_poller_task_t *  task,
const apr_pollfd_t *  descriptor 
)

Remove descriptor from pollset.

Parameters
taskthe task which holds the pollset
descriptorthe descriptor to remove
apt_bool_t apt_poller_task_destroy ( apt_poller_task_t *  task)

Destroy poller task.

Parameters
taskthe task to destroy
void* apt_poller_task_object_get ( const apt_poller_task_t *  task)

Get external object.

Parameters
taskthe poller task to get object from
apt_bool_t apt_poller_task_start ( apt_poller_task_t *  task)

Start poller task and wait for incoming messages.

Parameters
taskthe task to start
apt_bool_t apt_poller_task_terminate ( apt_poller_task_t *  task)

Terminate poller task.

Parameters
taskthe task to terminate
apt_timer_t* apt_poller_task_timer_create ( apt_poller_task_t *  task,
apt_timer_proc_f  proc,
void *  obj,
apr_pool_t *  pool 
)

Create timer.

Parameters
taskthe poller task to create timer in the scope of
procthe timer callback
objthe object to pass to callback
poolthe pool to allocate memory from
apt_task_vtable_t* apt_poller_task_vtable_get ( const apt_poller_task_t *  task)

Get task vtable.

Parameters
taskthe poller task to get vtable from