0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

exit faster on ctrl-c

This commit is contained in:
Dwight 2009-10-05 12:59:51 -04:00
parent 4142f3ebe4
commit 2967c63e92
2 changed files with 12 additions and 10 deletions

View File

@ -882,6 +882,15 @@ namespace mongo {
#undef out
void exitCleanly() {
goingAway = true;
{
dblock lk;
log() << "now exiting" << endl;
dbexit( EXIT_KILL );
}
}
#if !defined(_WIN32)
} // namespace mongo
@ -922,11 +931,7 @@ namespace mongo {
int x;
sigwait( &asyncSignals, &x );
log() << "got kill or ctrl c signal " << x << " (" << strsignal( x ) << "), will terminate after current cmd ends" << endl;
{
dblock lk;
log() << "now exiting" << endl;
dbexit( EXIT_KILL );
}
exitCleanly();
}
void setupSignals() {
@ -946,11 +951,7 @@ namespace mongo {
#else
void ctrlCTerminate() {
log() << "got kill or ctrl c signal, will terminate after current cmd ends" << endl;
{
dblock lk;
log() << "now exiting" << endl;
dbexit( EXIT_KILL );
}
exitCleanly();
}
BOOL CtrlHandler( DWORD fdwCtrlType )
{

View File

@ -289,6 +289,7 @@ assert( !eloc.isNull() );
}
Extent* MongoDataFile::createExtent(const char *ns, int approxSize, bool newCapped, int loops) {
massert( "shutdown in progress", !goingAway );
massert( "bad new extent size", approxSize >= 0 && approxSize <= 0x7ff00000 );
massert( "header==0 on new extent: 32 bit mmap space exceeded?", header ); // null if file open failed
int ExtentSize = approxSize <= header->unusedLength ? approxSize : header->unusedLength;