TASK.INTRO(3C++)

NAME
task - coroutines, multiple threads of control, C++ task library

SYNOPSIS
#include <task.h>
class object;
class sched : public object;
class timer : public sched;
class task  : public sched;

class qhead : public object;
class qtail : public object;

class Interrupt_handler : public object;

class histogram;
class randint;
class urand : public randint;
class erand : public randint;

DESCRIPTION
The C++ task library provides facilities for writing programs with multiple threads of control within one UNIX system process. Each thread of control is a task or coroutine. Each task is an instance of a user-defined class derived from class task, and the main program of the task is the constructor of its class. A task can be suspended and resumed without interfering with its internal state. Each task runs until it explicitly gives up the processor; there is no pre-emption.

Most classes in the task system are derived from the base class object. The base class sched is responsible for scheduling and for the functionality that is common to tasks and timers. Class sched is meant to be used strictly as a base class, that is, it is illegal to create objects of class sched. Class task must also be used only as a base class. The programmer must derive a class from class task, and provide a constructor to serve as the task's main program. The task system can be used for writing event-driven simulations. tasks execute in a simulated time frame. Objects of class timer provide a facility for implementing time-outs and other time-dependent phenomena. Classes task, timer, sched, and object and their public member functions are described on the task(3C++) manual page.

Classes qhead and qtail enable a wide range of message-passing and data-buffering schemes to be implemented simply. These classes are described on the queue(3C++) manual page.

Class Interrupt_handler provides an interface for writing classes that can wait for external events using UNIX system signals. These classes are described on the interrupt(3C++) manual page.

Class histogram aids data gathering. Classes randint, urand, and erand provide random number generation. These four classes are described on the tasksim(3C++) manual page.

SEE ALSO
task(3C++), queue(3C++), interrupt(3C++), tasksim(3C++)
Stroustrup, B. and Shopiro, J. E., "A Set of C++ Classes for Co-routine Style Programming," in AT&T C++ Language System Release 2.0 Library Manual.
Shopiro, J. E., "Extending the C++ Task System for Real-Time Control," in AT&T C++ Language System Release 2.0 Library Manual.