- Invoke an application call-back function with the error code and
problem description text. If the error code is MDB_PANIC then
the application knows that it needs to make final arrangements.
Sounds good to me for now, since it doesn't mean walking all over
the code. mdb.c can just #define its own assert(). No error
code, the context is just "we're about to abort" and I don't know
of other planned callbacks which the code would help.
/** User-settable callback for assert(), called before abort()
- instead of printing the message.
- assert(some user errors) might be unaffected. This hack
- should become obsolete as lmdb's error handling matures.
- @param[in] msg The assertion message, not including newline.
- @parem[in] info Currently NULL. Might change in the future.
*/
extern void (*mdb_assert_cb)(char *msg, void *info);
(Or maybe call it -before- printing the message, you can abort or
longjmp yourself if you don't want the message.)
Looks good. I'll code up an example implementation to set and use
the callback. The "info" argument should be sufficient to figure
out which database is failing.