Table of Contents

Name

qt_sinc_create - allocate and/or initialize a sinc

Synopsis

#include <qthread/sinc.h>

qt_sinc_t *
qt_sinc_create (size_t sizeof_value,
const void *initial_value,
qt_sinc_op_f op,
size_t expect);

void
qt_sinc_init (qt_sinc_t *restrict sinc,
size_t sizeof_value,
const void *initial_value,
qt_sinc_op_f op,
size_t expect);

Description

These functions allocate and/or initialize a qt_sinc_t object and prepares it for performing reduction operations. The sinc is initialized to recieve expect submissions. These submissions may be from different tasks or from the same task. Each submission may also include a value of size sizeof_value (see the qt_sinc_submit() man page). The values submitted will be reduced to a single value using the function op, and the initial value to be reduced into will be the sizeof_value bytes at the address indicated by initial_value. The qt_sinc_init() function will initialize an existing qt_sinc_t variable, specified as the sinc argument, while the qt_sinc_create() function will allocate a new qt_sinc_t.

The op argument must be a function pointer with a qt_sinc_op_f prototype, such as:

void op (void *target, void *src);

The function must read sizeof_value bytes out of the src and target arguments, perform whatever reduction operation is necessary, and store the result into, at most, sizeof_value bytes at the target address.

Return Values

Returns an initialized qt_sinc_t object.

See Also

qt_sinc_destroy(3) , qt_sinc_expect(3) , qt_sinc_fini(3) , qt_sinc_reset(3) , qt_sinc_submit(3) , qt_sinc_wait(3)


Table of Contents