From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: An other question about locking functions in classes Date: 27 Sep 2000 09:53:38 GMT Organization: Aachen University of Technology (RWTH) Lines: 35 Message-ID: <8qsg32$fu2$1@nets3.rz.RWTH-Aachen.DE> References: <8qsakc$9ak$1 AT news DOT germany DOT net> NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 970048418 16322 137.226.32.75 (27 Sep 2000 09:53:38 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 27 Sep 2000 09:53:38 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Martin Czamai wrote: > class Class > { ... > static void my_ISR(); > static END_OF_FUNCTION(my_ISR); > ... > } *No* access is a bit strong. You'll not have access to non-static member variables, and you can't call non-static methods, but that's all the limitation. This is by definition of the C++ language. It's what 'static' is about: it makes members and methods that belong to the class as such, not a particular object (an 'instance', in C++ speak). Remember that the IRQ of the CPU has no idea whatsoever about classes or objects. Any member variables used by that IRQ handler will have to be made 'static', too, and also protected against paging. > The static keyword is necessary to make it possible to lock my_ISR in > memory, which is required since my_ISR is a interrupt service routine that > must NOT be swapped out to disk. I'ld advise to seriously re-think the whole plan of having the ISR be a member of a class. It'll be a whole lot easier to implement as a standalone function, and all its data standalone global or static variables. C++ and low-level programming of this type don't mix all that well. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.