Apache Portable Runtime Utility Library
Typedefs | Functions
Thread Safe FIFO bounded queue

Typedefs

typedef struct apr_queue_t apr_queue_t
 

Functions

apr_status_t apr_queue_create (apr_queue_t **queue, unsigned int queue_capacity, apr_pool_t *a)
 
apr_status_t apr_queue_push (apr_queue_t *queue, void *data)
 
apr_status_t apr_queue_pop (apr_queue_t *queue, void **data)
 
apr_status_t apr_queue_trypush (apr_queue_t *queue, void *data)
 
apr_status_t apr_queue_trypop (apr_queue_t *queue, void **data)
 
apr_status_t apr_queue_timedpush (apr_queue_t *queue, apr_interval_time_t timeout, void *data)
 
apr_status_t apr_queue_timedpop (apr_queue_t *queue, apr_interval_time_t timeout, void **data)
 
unsigned int apr_queue_size (apr_queue_t *queue)
 
apr_status_t apr_queue_interrupt_all (apr_queue_t *queue)
 
apr_status_t apr_queue_term (apr_queue_t *queue)
 

Detailed Description

Typedef Documentation

◆ apr_queue_t

typedef struct apr_queue_t apr_queue_t

opaque structure

Function Documentation

◆ apr_queue_create()

apr_status_t apr_queue_create ( apr_queue_t **  queue,
unsigned int  queue_capacity,
apr_pool_t *  a 
)

create a FIFO queue

Parameters
queueThe new queue
queue_capacitymaximum size of the queue
apool to allocate queue from

◆ apr_queue_interrupt_all()

apr_status_t apr_queue_interrupt_all ( apr_queue_t queue)

interrupt all the threads blocking on this queue.

Parameters
queuethe queue

◆ apr_queue_pop()

apr_status_t apr_queue_pop ( apr_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 successful pop

◆ apr_queue_push()

apr_status_t apr_queue_push ( apr_queue_t queue,
void *  data 
)

push/add an 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 successful push

◆ apr_queue_size()

unsigned int apr_queue_size ( apr_queue_t queue)

returns the size of the queue.

Warning
this is not threadsafe, and is intended for reporting/monitoring of the queue.
Parameters
queuethe queue
Returns
the size of the queue

◆ apr_queue_term()

apr_status_t apr_queue_term ( apr_queue_t queue)

terminate the queue, sending an interrupt to all the blocking threads

Parameters
queuethe queue

◆ apr_queue_timedpop()

apr_status_t apr_queue_timedpop ( apr_queue_t queue,
apr_interval_time_t  timeout,
void **  data 
)

pop/get an object from the queue, blocking if the queue is already empty until the timeout is reached.

Parameters
queuethe queue
timeoutthe amount of time in microseconds to wait.
datathe data
Returns
APR_EINTR the blocking was interrupted (try again)
APR_EOF if the queue has been terminated
APR_TIMEUP the timeout has been reached
APR_SUCCESS on a successful pop

◆ apr_queue_timedpush()

apr_status_t apr_queue_timedpush ( apr_queue_t queue,
apr_interval_time_t  timeout,
void *  data 
)

push/add an object to the queue, blocking if the queue is already full until the timeout is reached.

Parameters
queuethe queue
timeoutthe amount of time in microseconds to wait.
datathe data
Returns
APR_EINTR the blocking was interrupted (try again)
APR_EOF the queue has been terminated
APR_TIMEUP the timeout has been reached
APR_SUCCESS on a successful push

◆ apr_queue_trypop()

apr_status_t apr_queue_trypop ( apr_queue_t queue,
void **  data 
)

pop/get an object to the queue, returning immediately 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 successful pop

◆ apr_queue_trypush()

apr_status_t apr_queue_trypush ( apr_queue_t queue,
void *  data 
)

push/add an object to the queue, returning immediately 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 successful push