On Tuesday 10 April 2001 15:49, Olaf Petzold wrote:
> > What are you looking for in particular? The code generated by the C++
> > compiler for an object instantiation is basically equivalent to
> >
> > myclass_t *myobject;
> > myobject = malloc(sizeof(myclass_t));
> > if(!myobject)
> > <throw exception>;
>
> Do you know a way to catch the exceptions in kernel space ?
I never needed to (my new/delete implementations "cheat" some), but I guess
you could do something like the thing Linus figured out for some commonly
used kernel macros, like the user memory access function with area checking.
These use a form of exception handling to eliminate the checking overhead
from the main execution path.
I'm not sure about what the compiler expects to find, though; probably
something similar to setjmp() and longjmp().
A simple hack might be to just terminate the current thread if you run out of
memory, and then call a clean-up callback assigned to it. (Obviously, this
isn't very useful unless running out of memory really *is* fatal to the
thread - and if it is, you probably shouldn't be doing dynamic allocation in
the first place.)
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/