INTERRUPT(3C++) — C++ Task Library
NAME
Interrupt_handler − signal handling for the C++ task library
SYNOPSIS
#include <task.h>
class Interrupt_handler : public object {
virtual voidinterrupt();
public:
Interrupt_handler(int);
~Interrupt_handler();
objtypeo_type();
intpending();
};
DESCRIPTION
Class Interrupt_handler allows tasks to wait for external events in the form of SunOS system signals. Class Interrupt_handler is derived from class object so that tasks can wait for Interrupt_handler objects. Class object is described on the task(3) manual page.
The public member functions supplied in the task system class Interrupt_handler are listed and described below. The following symbols are used:
ih an Interrupt_handler object
i an int
eo an objtype enumeration
Interrupt_handler ih( i );
Constructs a new Interrupt_handler object, ih, which is to wait for a signal number i. (See signal(2).) Once an Interrupt_handler object has been established for a particular signal, when that signal occurs, the private, virtual interrupt() function is called at real time. When it returns, control will resume at the point where the current task was interrupted. That is, signals do not cause the current task to be pre-empted. When the currently running task is suspended, a special, built-in task, the interrupt alerter will be scheduled. This task alerts the Interrupt_handler (and any others that have received interrupts since the interrupt alerter last ran), and thereby makes any tasks waiting for those Interrupt_handlers runnable. As long as any Interrupt_handler exists, the scheduler will wait for an interrupt, rather than exiting when the run chain becomes empty.
void interrupt()
The private, virtual function, Interrupt_handler::interrupt() is a null function, but because it is virtual, the programmer can specify the action to be taken at interrupt time by defining an interrupt() function in a class derived from Interrupt_handler.
eo = ih.o_type()
Returns the class type of the object ( object::INTHANDLER). o_type() is a virtual function.
i = ih.pending()
Returns TRUE except the first time it is called after a signal occurs.
DIAGNOSTICS
See task(3).
SEE ALSO
TASK.INTRO(3C++), task(3C++), queue(3C++), tasksim(3C++), signal(2)
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.
Sun Microsystems — Last change: 13 July 1989