home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progc
/
c_all592.arj
/
TI652.ASC
< prev
next >
Wrap
Text File
|
1992-02-25
|
1KB
|
67 lines
PRODUCT : C++ NUMBER : 652
VERSION : All
OS : PC DOS
DATE : February 25, 1992 PAGE : 1/1
TITLE : Interrupt Handlers as Member Functions
An interrupt handler cannot be made a static member of a
class because there is no way to pass such a function a 'this'
pointer. It is possible, however, to overcome this difficulty by
creating a static member function that is given access to a
pointer to the class that is currently active. For example:
class ISR {
public:
static void interrupt handler();
ISR *active;
void handle();
};
void interrupt ISR::handler() {
active->handle();
}
In this example, ISR::handler() is installed as the handler and
active must be set to point to a valid instance of ISR.