This is a document to specify the globus_fifo data type API and implementation as included in the globus_common library.
The globus_fifo data type provides an abstract FIFO queue representation and operations on such queues. These queues can contain arbitrary data in the form of a void pointer for each datum. It is the user's responsibility to provide and interpret data of the correct type.
The globus_fifo API implementation assumes volatile storage for the queue elements and is therefore appropriate for use as shared-data in multithreaded programming.
typedef globus_fifo_t
A structure representing a queued sequence of data.
nt
globus_fifo_init (
globus_fifo_t
* fifo
)
Initializes a fifo location to represent an empty sequence of data and returns zero, or returns non-zero on failure.
void
globus_fifo_destroy (
globus_fifi_t * fifo )
Destroys a fifo representation, releasing any resources used to represent the data sequence (abandoning any data in the queue). After this call, a fifo is no longer considered initialized.
It is an error to destroy a fifo that is not initialized.
| globus_fifo_t * | fifo ) |
The predicate globus_fifo_empty returns non-zero iff there is no datum in the queue, otherwise returns zero (0).
It is an error to call this routine on an uninitialized queue.
| globus_fifo_t * | fifo ) |
The routine globus_fifo_size computes and returns the total number of data contained in the queue, and an empty queue has zero elements.
It is an error to call this routine on an uninitialized queue.
| globus_fifo_t * | fifo , | ||
| void * | datum ) |
The routine globus_fifo_enqueue adds a new element to the data sequence stored in the queue, returning zero on success or non-zero on failure.
It is an error to call this routine on an uninitialized queue.
| globus_fifo_t * | source ) |
The globus_fifo_copy constructor creates a newly allocated queue containing the same ordered data as the source queue.
It is an error to call this routine on an uninitialized queue.
| globus_fifo_t * | fifo ) |
The accessor globus_fifo_peek returns the datum in the queue which was enqueued first.
It is an error to call this routine on an uninitialized or empty queue.
| globus_fifo_t * | fifo ) |
The accessor globus_fifo_tail_peek returns the datum in the queue which was enqueued last.
It is an error to call this routine on an uninitialized or empty queue.
| globus_fifo_t * | fifo ) |
The globus_fifo_dequeue removes the first element that was enqueued and returns that datum.
It is an error to call this routine on an uninitialized or empty queue.
| globus_fifo_t * | fifo , | ||
| void * | datum ) |
The globus_fifo_remove routine modifies the data sequence of the queue such that the first occurence of datum is no longer in the sequence, returning datum; if datum does not appear in the sequence, no changes are made and NULL is returned.
It is an error to call this routine on an uninitialized queue.