Table of Contents
qt_loop_queue_run, qt_loop_queue_run_there - an intelligent implementation
of a threaded loop
#include <qthread/qloop.h>
void
qt_loop_queue_run (qqloop_handle_t *loop);
void
qt_loop_queue_run_there (qqloop_handle_t *loop,
qthread_shepherd_id_t shep);
These functions provide an adaptive
implementation of a threaded loop. In the case of qt_loop_queue_run(), the
number of threads used depends upon the number of shepherds available (and
active). The qt_loop_queue_run_there() function spawns a single worker thread
on the specified shepherd. Iterations of the loop are processed in chunks,
where the size of each chunk is variable and is determined by the style
of adaptivity selection when creating the loop handle loop. If a shepherd
is deactivated while processing the loop, the worker thread assigned to
that shepherd will exit and the remaining worker threads will automatically
adapt. Otherwise, these functions behave somewhat similarly to qt_loop_balance()
in that they will not return until all iterations of the loop have been
completed.
The loop handle must be allocated by qt_loop_queue_create(),
and will be deallocated by these functions.
qt_loop(3)
, qt_loop_balance(3)
,
qt_loopaccum_balance(3)
, qt_loop_queue_create(3)
, qt_loop_queue_addworker(3)
Table of Contents