ao_barrier.h
Barriers

Notes

This module defines execution barriers, where tasks can synchronize.

Include

ao_async.h
ao_list.h
ao_time.h
ao_uint.h
stdbool.h

Types

ao_barrier_t

typedef struct ao_barrier_t ao_barrier_t;

Represents a barrier.

ao_barrier_wait_t

typedef struct ao_barrier_wait_t ao_barrier_wait_t;

Represents the waiting at a barrier.

Structs

ao_barrier_t

struct ao_barrier_t
{
    ao_uint_t count;
    ao_uint_t count_threshold;
    ao_list_t wait;
};
count The current number of waitings.
count_threshold The maximum number waitings.
wait The list of waitings.

ao_barrier_wait_t

struct ao_barrier_wait_t
{
    ao_async_t     async;
    ao_barrier_t * barrier;
    ao_list_node_t barrier_wait_node;
    bool volatile  result;
};
async The asynchronous event.
barrier The barrier.
barrier_wait_node The node for the barrier’s list of waitings.
result The result.

Functions

ao_barrier_wait

ao_barrier_wait_from

bool ao_barrier_wait     (ao_barrier_t * b, ao_time_t timeout);
bool ao_barrier_wait_from(ao_barrier_t * b, ao_time_t timeout, ao_time_t beginning);

Waits at a barrier in a blocking fashion with a timeout and an optional beginning.

ao_barrier_wait_forever

bool ao_barrier_wait_forever(ao_barrier_t * b);

Waits at a barrier indefinitely in a blocking fashion.

ao_barrier_wait_try

bool ao_barrier_wait_try(ao_barrier_t * b);

Waits at a barrier in a non-blocking fashion.

ao_barrier_wait_begin

ao_barrier_wait_end

void ao_barrier_wait_begin(ao_barrier_wait_t * w);
void ao_barrier_wait_end  (ao_barrier_wait_t * w);

Begins or ends, respectively, a waiting at a barrier.

External Links