Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Thread Safe FIFO bounded queue
[Brought To You By APR]


Typedefs

typedef apr_queue_t switch_queue_t

Functions

switch_status_t switch_queue_create (switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
switch_status_t switch_queue_pop (switch_queue_t *queue, void **data)
switch_status_t switch_queue_push (switch_queue_t *queue, void *data)
unsigned int switch_queue_size (switch_queue_t *queue)
switch_status_t switch_queue_trypop (switch_queue_t *queue, void **data)
switch_status_t switch_queue_trypush (switch_queue_t *queue, void *data)


Typedef Documentation

typedef struct apr_queue_t switch_queue_t
 

Opaque structure used for queue API


Function Documentation

switch_status_t switch_queue_create switch_queue_t **  queue,
unsigned int  queue_capacity,
switch_memory_pool_t pool
 

create a FIFO queue

Parameters:
queue The new queue
queue_capacity maximum size of the queue
pool a pool to allocate queue from
00762 {
00763         return apr_queue_create(queue, queue_capacity, pool);
00764 }

switch_status_t switch_queue_pop switch_queue_t queue,
void **  data
 

pop/get an object from the queue, blocking if the queue is already empty

Parameters:
queue the queue
data the data
Returns:
APR_EINTR the blocking was interrupted (try again)

APR_EOF if the queue has been terminated

APR_SUCCESS on a successfull pop

00772 {
00773         return apr_queue_pop(queue, data);
00774 }

switch_status_t switch_queue_push switch_queue_t queue,
void *  data
 

push/add a object to the queue, blocking if the queue is already full

Parameters:
queue the queue
data the data
Returns:
APR_EINTR the blocking was interrupted (try again)

APR_EOF the queue has been terminated

APR_SUCCESS on a successfull push

00777 {
00778         apr_status_t s;
00779 
00780         do {
00781                 s = apr_queue_push(queue, data);
00782         } while (s == APR_EINTR);
00783 
00784         return s;
00785 }

unsigned int switch_queue_size switch_queue_t queue  ) 
 

returns the size of the queue.

Warning:
this is not threadsafe, and is intended for reporting/monitoring of the queue.
Parameters:
queue the queue
Returns:
the size of the queue
00767 {
00768         return apr_queue_size(queue);
00769 }

switch_status_t switch_queue_trypop switch_queue_t queue,
void **  data
 

pop/get an object to the queue, returning immediatly if the queue is empty

Parameters:
queue the queue
data the data
Returns:
APR_EINTR the blocking operation was interrupted (try again)

APR_EAGAIN the queue is empty

APR_EOF the queue has been terminated

APR_SUCCESS on a successfull push

00788 {
00789         return apr_queue_trypop(queue, data);
00790 }

switch_status_t switch_queue_trypush switch_queue_t queue,
void *  data
 

push/add a object to the queue, returning immediatly if the queue is full

Parameters:
queue the queue
data the data
Returns:
APR_EINTR the blocking operation was interrupted (try again)

APR_EAGAIN the queue is full

APR_EOF the queue has been terminated

APR_SUCCESS on a successfull push

00793 {
00794         apr_status_t s;
00795 
00796         do {
00797                 s = apr_queue_trypush(queue, data);
00798         } while (s == APR_EINTR);
00799 
00800         return s;
00801 }


Generated on Fri Oct 10 11:24:22 2008 for FreeSWITCH by  doxygen 1.3.9.1