trap segfaults and such and try to log them on windows

we also try to write a note to the windows event viewer
This commit is contained in:
dwight
2011-04-18 18:44:38 -04:00
parent 736733e957
commit 4f969e112a
9 changed files with 81 additions and 22 deletions

View File

@@ -220,6 +220,15 @@ namespace mongo {
return ok;
}
void (*reportEventToSystem)(const char *msg) = 0;
void mongoAbort(const char *msg) {
if( reportEventToSystem )
reportEventToSystem(msg);
rawOut(msg);
::abort();
}
// Returns false when request includes 'end'
void assembleResponse( Message &m, DbResponse &dbresponse, const HostAndPort& remote ) {
@@ -755,7 +764,7 @@ namespace mongo {
}
if( --n <= 0 ) {
log() << "shutdown: couldn't acquire write lock, aborting" << endl;
abort();
mongoAbort("couldn't acquire write lock");
}
log() << "shutdown: waiting for write lock..." << endl;
}