[DGD] am I in atomic?
Noah Gibbs
noah_gibbs at yahoo.com
Thu Dec 21 21:29:07 CET 2006
Remember that errord knows whether an error was from atomic code or not. The
way it currently works in Phantasmal (not my approach, but I think it works
well) is to store up atomic errors and, if the error generates an exception,
package up the error output with the exception so that the next layer up can
say, "oh, there was an atomic error down there, we can just unpack it and write
it to the logfile".
The way Phantasmal does this is to add a "$" between the exception's text and
the error log output which would otherwise be written to the file. So an
atomic error figures out what it needs to know about the error, appends a
dollar sign and that information to the error, and passes the exception right
up the tree to the next handler. Of course, that handler could also be atomic
- I don't remember if Phantasmal handles this properly or not.
This all works pretty well. There are, of course, many alternate approaches.
For instance, you could keep one or more strings tucked away somewhere with
"pending" errors of the "I'd write it to the log but we're in atomic code"
variety, and only write them out when you get another "normal" error rather
than an atomic one. One downside of this is that atomic errors will only be
logged if an exception doesn't roll you back up out of atomic code, so I think
it's non-intuitive - but like many other approaches, just because I don't like
it doesn't mean it's not the approach for you :-)
--- Shentino <shentino at gmail.com> wrote:
> Hmm...maybe I could program my errord to be disableable by the code
> that does the dummy write...
>
> Now I just need to find a safe location to write to that both won't
> cause damage and won't get blocked by the Klib...
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the DGD
mailing list