本文整理汇总了C++中quickExit函数的典型用法代码示例。如果您正苦于以下问题:C++ quickExit函数的具体用法?C++ quickExit怎么用?C++ quickExit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quickExit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: log
void DeathTestImpl::_doTest() {
#ifdef _WIN32
log() << "Skipping death test on Windows";
return;
#else
int pipes[2];
checkSyscall(pipe(pipes));
pid_t child;
checkSyscall(child = fork());
if (child) {
checkSyscall(close(pipes[1]));
char buf[1000];
std::ostringstream os;
ssize_t bytesRead;
while (0 < (bytesRead = read(pipes[0], buf, sizeof(buf)))) {
os.write(buf, bytesRead);
invariant(os);
}
checkSyscall(bytesRead);
pid_t pid;
int stat;
while (child != (pid = waitpid(child, &stat, 0))) {
invariant(pid == -1);
const int err = errno;
switch (err) {
case EINTR:
continue;
default:
severe() << "Unrecoverable error while waiting for " << child << ": "
<< errnoWithDescription(err);
MONGO_UNREACHABLE;
}
}
if (WIFSIGNALED(stat) || (WIFEXITED(stat) && WEXITSTATUS(stat) != 0)) {
// Exited with a signal or non-zero code. Should check the pattern, here,
// but haven't figured out how, so just return.
ASSERT_STRING_CONTAINS(os.str(), getPattern());
return;
} else {
invariant(!WIFSTOPPED(stat));
}
FAIL("Expected death, found life\n\n") << os.str();
}
// This code only executes in the child process.
checkSyscall(close(pipes[0]));
checkSyscall(dup2(pipes[1], 1));
checkSyscall(dup2(1, 2));
try {
_test->run();
} catch (const TestAssertionFailureException& tafe) {
log() << "Caught test exception while expecting death: " << tafe;
// To fail the test, we must exit with a successful error code, because the parent process
// is checking for the child to die with an exit code indicating an error.
quickExit(EXIT_SUCCESS);
}
quickExit(EXIT_SUCCESS);
#endif
}
示例2: runGlobalInitializersOrDie
void runGlobalInitializersOrDie(int argc, const char* const* argv, const char* const* envp) {
Status status = runGlobalInitializers(argc, argv, envp);
if (!status.isOK()) {
std::cerr << "Failed global initialization: " << status << std::endl;
quickExit(1);
}
}
示例3: fassertFailedWithStatus
MONGO_COMPILER_NORETURN void fassertFailedWithStatus(int msgid, const Status& status) {
log() << "Fatal assertion " << msgid << " " << status;
logContext();
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
quickExit(EXIT_ABRUPT);
}
示例4: invariantFailed
NOINLINE_DECL void invariantFailed(const char* expr, const char* file, unsigned line) {
log() << "Invariant failure " << expr << ' ' << file << ' ' << dec << line << endl;
logContext();
breakpoint();
log() << "\n\n***aborting after invariant() failure\n\n" << endl;
quickExit(EXIT_ABRUPT);
}
示例5: fassertFailed
NOINLINE_DECL void fassertFailed(int msgid) {
log() << "Fatal Assertion " << msgid << endl;
logContext();
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
quickExit(EXIT_ABRUPT);
}
示例6: WinsockInit
WinsockInit() {
WSADATA d;
if (WSAStartup(MAKEWORD(2, 2), &d) != 0) {
log() << "ERROR: wsastartup failed " << errnoWithDescription();
quickExit(EXIT_NTSERVICE_ERROR);
}
}
示例7: fassertFailedNoTraceWithLocation
NOINLINE_DECL void fassertFailedNoTraceWithLocation(int msgid,
const char* file,
unsigned line) noexcept {
log() << "Fatal Assertion " << msgid << " at " << file << " " << dec << line;
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
quickExit(EXIT_ABRUPT);
}
示例8: dbexit
void dbexit(ExitCode rc, const char *why){
{
boost::lock_guard<boost::mutex> sl(shutDownMutex);
shuttingDown = true;
}
quickExit(rc);
}
示例9: MONGO_STARTUP_OPTIONS_STORE
MONGO_STARTUP_OPTIONS_STORE(MongoShellOptions)(InitializerContext* context) {
Status ret = storeMongoShellOptions(moe::startupOptionsParsed, context->args());
if (!ret.isOK()) {
std::cerr << ret.toString() << std::endl;
std::cerr << "try '" << context->args()[0] << " --help' for more information" << std::endl;
quickExit(EXIT_BADOPTIONS);
}
return Status::OK();
}
示例10: invariantOKFailed
NOINLINE_DECL void invariantOKFailed(const char* expr, const Status& status, const char *file,
unsigned line) {
log() << "Invariant failure: " << expr << " resulted in status " << status
<< " at " << file << ' ' << dec << line;
logContext();
breakpoint();
log() << "\n\n***aborting after invariant() failure\n\n" << endl;
quickExit(EXIT_ABRUPT);
}
示例11: exitCleanly
void exitCleanly(ExitCode code) {
{
stdx::lock_guard<stdx::mutex> lk(mongo::shell_utils::mongoProgramOutputMutex);
mongo::dbexitCalled = true;
}
::killOps();
::shellHistoryDone();
quickExit(0);
}
示例12: MONGO_STARTUP_OPTIONS_VALIDATE
MONGO_STARTUP_OPTIONS_VALIDATE(FrameworkOptions)(InitializerContext* context) {
if (!handlePreValidationTestFrameworkOptions(moe::startupOptionsParsed, context->args())) {
quickExit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
if (!ret.isOK()) {
return ret;
}
return Status::OK();
}
示例13: MONGO_STARTUP_OPTIONS_VALIDATE
MONGO_STARTUP_OPTIONS_VALIDATE(MongoBridgeOptions)(InitializerContext* context) {
if (!handlePreValidationMongoBridgeOptions(moe::startupOptionsParsed)) {
quickExit(EXIT_SUCCESS);
}
Status ret = moe::startupOptionsParsed.validate();
if (!ret.isOK()) {
return ret;
}
return Status::OK();
}
示例14: fassertFailedWithStatusNoTraceWithLocation
MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTraceWithLocation(int msgid,
const Status& status,
const char* file,
unsigned line) noexcept {
log() << "Fatal assertion " << msgid << " " << redact(status) << " at " << file << " " << dec
<< line;
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
quickExit(EXIT_ABRUPT);
}
示例15: dbexit
void dbexit( ExitCode returnCode, const char *whyMsg ) {
{
mongo::mutex::scoped_lock lk( shell_utils::mongoProgramOutputMutex );
dbexitCalled = true;
}
log() << "dbexit called" << endl;
if ( whyMsg )
log() << " b/c " << whyMsg << endl;
log() << "exiting" << endl;
quickExit( returnCode );
}