ao_recv_obj.h
Receiving objects

Notes

This module provides an abstraction for receiving objects from an opaque source.

Include

ao_async.h
ao_time.h
stdbool.h

Types

ao_recv_obj_t

typedef struct ao_recv_obj_t ao_recv_obj_t;

Represents the receiving of an object.

ao_recv_obj_proc_t

typedef void (* ao_recv_obj_proc_t)
(
    ao_recv_obj_t * recv
);

Represents a function beginning or ending a receiving of an object.

Structs

ao_recv_obj_t

struct ao_recv_obj_t
{
    ao_async_t         async;
    ao_recv_obj_proc_t begin;
    ao_recv_obj_proc_t end;
    void *             parameter;
    void *             ptr;
    bool volatile      result;
};
async The asynchronous event.
begin The function beginning the receiving.
end The function ending the receiving.
parameter An additional parameter.
ptr A pointer to a location to store the received object.
result The result.

Functions

ao_recv_obj

ao_recv_obj_from

void ao_recv_obj     (ao_recv_obj_t * r, ao_time_t timeout);
void ao_recv_obj_from(ao_recv_obj_t * r, ao_time_t timeout, ao_time_t beginning);

Receives an object in a blocking fashion with a timeout and an optional beginning.

ao_recv_obj_forever

void ao_recv_obj_forever(ao_recv_obj_t * r);

Receives an object indefinitely in a blocking fashion.

ao_recv_obj_try

void ao_recv_obj_try(ao_recv_obj_t * r);

Receives an object in a non-blocking fashion.

ao_recv_obj_begin

ao_recv_obj_end

void ao_recv_obj_begin(ao_recv_obj_t * r);
void ao_recv_obj_end  (ao_recv_obj_t * r);

Begins or ends, respectively, a receiving of an object.