ao_queue4obj.h
Queues for objects

Include

ao_async.h
ao_heap4obj.h
ao_list.h
ao_time.h
stdbool.h

Types

ao_queue4obj_t

typedef struct ao_queue4obj_t ao_queue4obj_t;

Represents a queue for objects.

ao_qinsert_obj_t

typedef struct ao_qinsert_obj_t ao_qinsert_obj_t;

Represents the inserting into a queue for objects.

ao_qpop_obj_t

typedef struct ao_qpop_obj_t ao_qpop_obj_t;

Represents the popping from a queue for objects.

Structs

ao_queue4obj_t

struct ao_queue4obj_t
{
    ao_heap4obj_t heap;
    ao_list_t     insert;
    ao_list_t     pop;
};
heap The heap.
insert The list of insertings.
pop The list of poppings.

ao_qinsert_obj_t

struct ao_qinsert_obj_t
{
    ao_async_t       async;
    void *           ptr;
    ao_queue4obj_t * queue;
    ao_list_node_t   queue_insert_node;
    bool volatile    result;
};
async The asynchronous event.
ptr The pointer to the object to insert.
queue The queue.
queue_insert_node The node for the queue’s list of insertings.
result The result.

ao_qpop_obj_t

struct ao_qpop_obj_t
{
    ao_async_t       async;
    void *           ptr;
    ao_queue4obj_t * queue;
    ao_list_node_t   queue_pop_node;
    bool volatile    result;
};
async The asynchronous event.
ptr The pointer to the location to store the popped object.
queue The queue.
queue_pop_node The node for the queue’s list of poppings.
result The result.

Functions

ao_qinsert_obj

ao_qinsert_obj_from

void ao_qinsert_obj     (ao_qinsert_obj_t * i, ao_time_t timeout);
void ao_qinsert_obj_from(ao_qinsert_obj_t * i, ao_time_t timeout, ao_time_t beginning);

Inserts an object into a queue in a blocking fashion with a timeout and an optional beginning.

ao_qinsert_obj_forever

void ao_qinsert_obj_forever(ao_qinsert_obj_t * i);

Inserts an object into a queue indefinitely in a blocking fashion.

ao_qinsert_obj_try

void ao_qinsert_obj_try(ao_qinsert_obj_t * i);

Inserts an object into a queue in a non-blocking fashion.

ao_qinsert_obj_begin

ao_qinsert_obj_end

void ao_qinsert_obj_begin(ao_qinsert_obj_t * i);
void ao_qinsert_obj_end  (ao_qinsert_obj_t * i);

Begins or ends, respectively, an inserting of an object into a queue.

ao_qpop_obj

ao_qpop_obj_from

void ao_qpop_obj     (ao_qpop_obj_t * p, ao_time_t timeout);
void ao_qpop_obj_from(ao_qpop_obj_t * p, ao_time_t timeout, ao_time_t beginning);

Pops an object from a queue in a blocking fashion with a timeout and an optional beginning.

ao_qpop_obj_forever

void ao_qpop_obj_forever(ao_qpop_obj_t * p);

Pops an object from a queue indefinitely in a blocking fashion.

ao_qpop_obj_try

void ao_qpop_obj_try(ao_qpop_obj_t * p);

Pops an object from a queue in a non-blocking fashion.

ao_qpop_obj_begin

ao_qpop_obj_end

void ao_qpop_obj_begin(ao_qpop_obj_t * p);
void ao_qpop_obj_end  (ao_qpop_obj_t * p);

Begins or ends, respectively, a popping of an object from a queue.