FreeSWITCH API Documentation  1.7.0
Typedefs | Functions
Thread Safe FIFO bounded queue
+ Collaboration diagram for Thread Safe FIFO bounded queue:

Typedefs

typedef struct 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_pop_timeout (switch_queue_t *queue, void **data, switch_interval_time_t timeout)
 
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_interrupt_all (switch_queue_t *queue)
 
switch_status_t switch_queue_term (switch_queue_t *queue)
 
switch_status_t switch_queue_trypush (switch_queue_t *queue, void *data)
 

Detailed Description

Typedef Documentation

typedef struct apr_queue_t switch_queue_t

Opaque structure used for queue API

Definition at line 590 of file switch_apr.h.

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
queueThe new queue
queue_capacitymaximum size of the queue
poola pool to allocate queue from

Definition at line 1109 of file switch_apr.c.

Referenced by chat_thread_start(), check_dispatch(), EventConsumer::EventConsumer(), inband_dtmf_generate_callback(), switch_channel_alloc(), switch_core_media_bug_add(), switch_core_media_bug_patch_spy_frame(), switch_core_memory_init(), switch_core_session_init(), switch_core_session_request_uuid(), switch_event_channel_broadcast(), switch_event_init(), switch_log_init(), switch_rtp_create(), switch_scheduler_task_thread_start(), and switch_sql_queue_manager_init_name().

1110 {
1111  return apr_queue_create(queue, queue_capacity, pool);
1112 }
switch_memory_pool_t * pool
switch_status_t switch_queue_interrupt_all ( switch_queue_t queue)

Definition at line 1145 of file switch_apr.c.

Referenced by EventConsumer::cleanup(), switch_event_shutdown(), and switch_sql_queue_manager_stop().

1146 {
1147  return apr_queue_interrupt_all(queue);
1148 }
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
queuethe queue
datathe data
Returns
APR_EINTR the blocking was interrupted (try again)
APR_EOF if the queue has been terminated
APR_SUCCESS on a successfull pop

Definition at line 1119 of file switch_apr.c.

Referenced by chat_thread_run(), log_thread(), pool_thread(), EventConsumer::pop(), switch_event_channel_deliver_thread(), switch_event_dispatch_thread(), and video_bug_thread().

1120 {
1121  return apr_queue_pop(queue, data);
1122 }
switch_status_t switch_queue_pop_timeout ( switch_queue_t queue,
void **  data,
switch_interval_time_t  timeout 
)

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

Parameters
queuethe queue
datathe data
timeoutThe amount of time in microseconds to wait. This is a maximum, not a minimum. If the condition is signaled, we will wake up before this time, otherwise the error APR_TIMEUP is returned.
Returns
APR_TIMEUP the request timed out
APR_EINTR the blocking was interrupted (try again)
APR_EOF if the queue has been terminated
APR_SUCCESS on a successfull pop

Definition at line 1124 of file switch_apr.c.

Referenced by EventConsumer::pop(), switch_core_session_thread_pool_worker(), and switch_scheduler_task_thread().

1125 {
1126  return apr_queue_pop_timeout(queue, data, timeout);
1127 }
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
queuethe queue
datathe data
Returns
APR_EINTR the blocking was interrupted (try again)
APR_EOF the queue has been terminated
APR_SUCCESS on a successfull push

Definition at line 1129 of file switch_apr.c.

Referenced by chat_queue_message(), switch_core_media_bug_close(), switch_core_media_bug_push_spy_frame(), switch_core_perform_destroy_memory_pool(), switch_core_session_queue_signal_data(), switch_core_session_read_video_frame(), switch_core_session_thread_pool_launch(), switch_core_session_write_video_frame(), switch_event_queue_dispatch_event(), switch_loadable_module_shutdown(), switch_log_shutdown(), switch_scheduler_add_task(), switch_scheduler_execute(), switch_sql_queue_manager_push_confirm(), switch_sql_queue_manager_stop(), switch_thread_pool_launch_thread(), and task_thread_loop().

1130 {
1131  apr_status_t s;
1132 
1133  do {
1134  s = apr_queue_push(queue, data);
1135  } while (s == APR_EINTR);
1136 
1137  return s;
1138 }
unsigned int switch_queue_size ( switch_queue_t queue)
switch_status_t switch_queue_term ( switch_queue_t queue)

Definition at line 1150 of file switch_apr.c.

Referenced by switch_core_session_uninit().

1151 {
1152  return apr_queue_term(queue);
1153 }
switch_status_t switch_queue_trypop ( switch_queue_t queue,
void **  data 
)
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
queuethe queue
datathe 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

Definition at line 1155 of file switch_apr.c.

Referenced by chat_queue_message(), event_handler(), generate_on_dtmf(), pool_thread(), switch_channel_dequeue_dtmf(), switch_channel_flush_dtmf(), switch_channel_queue_dtmf(), switch_core_session_queue_event(), switch_core_session_queue_message(), switch_core_session_queue_private_event(), switch_event_channel_broadcast(), switch_event_del_header_val(), switch_event_destroy(), switch_event_shutdown(), switch_log_node_free(), switch_log_vprintf(), switch_rtp_queue_rfc2833(), switch_rtp_queue_rfc2833_in(), and switch_sql_queue_manager_push().

1156 {
1157  apr_status_t s;
1158 
1159  do {
1160  s = apr_queue_trypush(queue, data);
1161  } while (s == APR_EINTR);
1162 
1163  return s;
1164 }