RTS API Documentation  1.10.11
Typedefs | Functions
Thread Safe FIFO bounded queue
+ Collaboration diagram for Thread Safe FIFO bounded queue:

Typedefs

typedef struct switch_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

◆ switch_queue_t

Opaque structure used for queue API

Definition at line 590 of file switch_apr.h.

Function Documentation

◆ switch_queue_create()

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 1233 of file switch_apr.c.

References switch_apr_queue_create().

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_frame_buffer_create(), switch_log_init(), switch_msrp_perform_send(), switch_rtp_create(), switch_scheduler_task_thread_start(), and switch_sql_queue_manager_init_name().

1234 {
1235  return switch_apr_queue_create(queue, queue_capacity, pool);
1236 }
switch_memory_pool_t * pool
fspr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, fspr_pool_t *a)

◆ switch_queue_interrupt_all()

switch_status_t switch_queue_interrupt_all ( switch_queue_t queue)

Definition at line 1269 of file switch_apr.c.

References switch_apr_queue_interrupt_all().

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

1270 {
1271  return switch_apr_queue_interrupt_all(queue);
1272 }
fspr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue)

◆ switch_queue_pop()

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 1243 of file switch_apr.c.

References switch_apr_queue_pop().

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

1244 {
1245  return switch_apr_queue_pop(queue, data);
1246 }
fspr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)

◆ switch_queue_pop_timeout()

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 1248 of file switch_apr.c.

References switch_apr_queue_pop_timeout().

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

1249 {
1250  return switch_apr_queue_pop_timeout(queue, data, timeout);
1251 }
fspr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, fspr_interval_time_t timeout)

◆ switch_queue_push()

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 1253 of file switch_apr.c.

References switch_apr_queue_push().

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_frame_buffer_push(), switch_loadable_module_shutdown(), switch_log_shutdown(), switch_scheduler_add_task_ex(), switch_scheduler_execute(), switch_sql_queue_manager_push_confirm(), switch_sql_queue_manager_stop(), switch_thread_pool_launch_thread(), and task_thread_loop().

1254 {
1255  fspr_status_t s;
1256 
1257  do {
1258  s = switch_apr_queue_push(queue, data);
1259  } while (s == APR_EINTR);
1260 
1261  return s;
1262 }
fspr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)

◆ switch_queue_size()

unsigned int switch_queue_size ( switch_queue_t queue)

◆ switch_queue_term()

switch_status_t switch_queue_term ( switch_queue_t queue)

Definition at line 1274 of file switch_apr.c.

References switch_apr_queue_term().

Referenced by switch_core_session_uninit(), and switch_msrp_perform_send().

1275 {
1276  return switch_apr_queue_term(queue);
1277 }
fspr_status_t switch_apr_queue_term(switch_apr_queue_t *queue)

◆ switch_queue_trypop()

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
queuethe queue
datathe 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

Definition at line 1264 of file switch_apr.c.

References switch_apr_queue_trypop().

Referenced by EventConsumer::cleanup(), do_2833(), do_flush(), do_trans(), flush_video_queue(), inband_dtmf_generate_callback(), new_header(), pool_thread(), EventConsumer::pop(), switch_channel_dequeue_dtmf(), switch_channel_flush_dtmf(), switch_channel_queue_dtmf(), switch_channel_set_timestamps(), switch_channel_uninit(), switch_core_media_bug_destroy(), switch_core_media_bug_patch_spy_frame(), switch_core_memory_reclaim(), switch_core_memory_reclaim_events(), switch_core_memory_reclaim_logger(), switch_core_memory_stop(), switch_core_perform_new_memory_pool(), switch_core_session_dequeue_event(), switch_core_session_dequeue_message(), switch_core_session_dequeue_private_event(), switch_core_session_dequeue_signal_data(), switch_core_session_flush_message(), switch_core_session_flush_private_events(), switch_core_session_perform_destroy(), switch_event_channel_deliver_thread(), switch_event_create_subclass_detailed(), switch_event_shutdown(), switch_frame_buffer_trypop(), switch_log_node_alloc(), switch_msrp_perform_send(), switch_msrp_session_destroy(), switch_rtp_dequeue_dtmf(), switch_rtp_destroy(), switch_scheduler_task_thread(), and video_bug_thread().

1265 {
1266  return switch_apr_queue_trypop(queue, data);
1267 }
fspr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data)

◆ switch_queue_trypush()

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 1279 of file switch_apr.c.

References switch_apr_queue_trypush().

Referenced by chat_queue_message(), event_handler(), free_header(), 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_destroy(), switch_event_shutdown(), switch_frame_buffer_trypush(), switch_log_meta_vprintf(), switch_log_node_free(), switch_msrp_perform_send(), switch_rtp_queue_rfc2833(), switch_rtp_queue_rfc2833_in(), and switch_sql_queue_manager_push().

1280 {
1281  fspr_status_t s;
1282 
1283  do {
1284  s = switch_apr_queue_trypush(queue, data);
1285  } while (s == APR_EINTR);
1286 
1287  return s;
1288 }
fspr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data)