本文整理汇总了C++中quickExit函数的典型用法代码示例。如果您正苦于以下问题:C++ quickExit函数的具体用法?C++ quickExit怎么用?C++ quickExit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quickExit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:59,代码来源:death_test.cpp
示例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);
}
}
开发者ID:3rf,项目名称:mongo,代码行数:7,代码来源:initializer.cpp
示例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);
}
开发者ID:Andiry,项目名称:mongo,代码行数:7,代码来源:assert_util.cpp
示例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);
}
开发者ID:Andiry,项目名称:mongo,代码行数:7,代码来源:assert_util.cpp
示例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);
}
开发者ID:Andiry,项目名称:mongo,代码行数:7,代码来源:assert_util.cpp
示例6: WinsockInit
WinsockInit() {
WSADATA d;
if (WSAStartup(MAKEWORD(2, 2), &d) != 0) {
log() << "ERROR: wsastartup failed " << errnoWithDescription();
quickExit(EXIT_NTSERVICE_ERROR);
}
}
开发者ID:zpzxgcr,项目名称:mongo,代码行数:7,代码来源:socket_utils.cpp
示例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);
}
开发者ID:Machyne,项目名称:mongo,代码行数:8,代码来源:assert_util.cpp
示例8: dbexit
void dbexit(ExitCode rc, const char *why){
{
boost::lock_guard<boost::mutex> sl(shutDownMutex);
shuttingDown = true;
}
quickExit(rc);
}
开发者ID:Amosvista,项目名称:mongo,代码行数:8,代码来源:scoped_db_conn_test.cpp
示例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();
}
开发者ID:Asamaha,项目名称:mongo,代码行数:9,代码来源:shell_options_init.cpp
示例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);
}
开发者ID:ambroff,项目名称:mongo,代码行数:9,代码来源:assert_util.cpp
示例11: exitCleanly
void exitCleanly(ExitCode code) {
{
stdx::lock_guard<stdx::mutex> lk(mongo::shell_utils::mongoProgramOutputMutex);
mongo::dbexitCalled = true;
}
::killOps();
::shellHistoryDone();
quickExit(0);
}
开发者ID:CeperaCPP,项目名称:mongo,代码行数:10,代码来源:dbshell.cpp
示例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();
}
开发者ID:ajdavis,项目名称:mongo,代码行数:10,代码来源:framework_options_init.cpp
示例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();
}
开发者ID:3rf,项目名称:mongo,代码行数:10,代码来源:mongobridge_options_init.cpp
示例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);
}
开发者ID:Machyne,项目名称:mongo,代码行数:10,代码来源:assert_util.cpp
示例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 );
}
开发者ID:ANTco,项目名称:mongo,代码行数:11,代码来源:clientAndShell.cpp
示例16: MONGO_STARTUP_OPTIONS_PARSE
MONGO_STARTUP_OPTIONS_PARSE(StartupOptions)(InitializerContext* context) {
OptionsParser parser;
Status ret = parser.run(startupOptions, context->args(), context->env(),
&startupOptionsParsed);
if (!ret.isOK()) {
std::cerr << ret.reason() << std::endl;
// TODO: Figure out if there's a use case for this help message ever being different
std::cerr << "try '" << context->args()[0]
<< " --help' for more information" << std::endl;
quickExit(EXIT_BADOPTIONS);
}
return Status::OK();
}
开发者ID:7segments,项目名称:mongo-1,代码行数:13,代码来源:options_parser_init.cpp
示例17: verifyFailed
NOINLINE_DECL void verifyFailed(const char* expr, const char* file, unsigned line) {
assertionCount.condrollover(++assertionCount.regular);
log() << "Assertion failure " << expr << ' ' << file << ' ' << dec << line << endl;
logContext();
stringstream temp;
temp << "assertion " << file << ":" << line;
AssertionException e(temp.str(), 0);
breakpoint();
#if defined(MONGO_CONFIG_DEBUG_BUILD)
// this is so we notice in buildbot
log() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl;
quickExit(EXIT_ABRUPT);
#endif
throw e;
}
开发者ID:Andiry,项目名称:mongo,代码行数:15,代码来源:assert_util.cpp
示例18: MozJSImplScope
/**
* The main loop for the implementation thread
*
* This owns the actual implementation scope (which needs to be created on this
* child thread) and has essentially two transition paths:
*
* Standard: ProxyRequest -> ImplResponse
* Invoke _function. Serialize exceptions to _status.
*
* Shutdown: Shutdown -> _
* break out of the loop and return.
*/
void MozJSProxyScope::implThread() {
if (hasGlobalServiceContext())
Client::initThread("js");
std::unique_ptr<MozJSImplScope> scope;
// This will leave _status set for the first noop runOnImplThread(), which
// captures the startup exception that way
try {
scope.reset(new MozJSImplScope(_engine));
_implScope = scope.get();
} catch (...) {
_status = exceptionToStatus();
}
while (true) {
stdx::unique_lock<stdx::mutex> lk(_mutex);
_condvar.wait(
lk, [this] { return _state == State::ProxyRequest || _state == State::Shutdown; });
if (_state == State::Shutdown)
break;
try {
_function();
} catch (...) {
_status = exceptionToStatus();
}
int exitCode;
if (_implScope && _implScope->getQuickExit(&exitCode)) {
scope.reset();
quickExit(exitCode);
}
_state = State::ImplResponse;
_condvar.notify_one();
}
}
开发者ID:qihsh,项目名称:mongo,代码行数:52,代码来源:proxyscope.cpp
示例19: wasserted
/* "warning" assert -- safe to continue, so we don't throw exception. */
NOINLINE_DECL void wasserted(const char* expr, const char* file, unsigned line) {
static bool rateLimited;
static time_t lastWhen;
static unsigned lastLine;
if (lastLine == line && time(0) - lastWhen < 5) {
if (!rateLimited) {
rateLimited = true;
log() << "rate limiting wassert" << endl;
}
return;
}
lastWhen = time(0);
lastLine = line;
log() << "warning assertion failure " << expr << ' ' << file << ' ' << dec << line << endl;
logContext();
assertionCount.condrollover(++assertionCount.warning);
#if defined(MONGO_CONFIG_DEBUG_BUILD)
// this is so we notice in buildbot
log() << "\n\n***aborting after wassert() failure in a debug/test build\n\n" << endl;
quickExit(EXIT_ABRUPT);
#endif
}
开发者ID:Andiry,项目名称:mongo,代码行数:24,代码来源:assert_util.cpp
示例20: MONGO_STARTUP_OPTIONS_VALIDATE
MONGO_STARTUP_OPTIONS_VALIDATE(MongosOptions)(InitializerContext* context) {
if (!handlePreValidationMongosOptions(moe::startupOptionsParsed, context->args())) {
quickExit(EXIT_SUCCESS);
}
// Run validation, but tell the Environment that we don't want it to be set as "valid",
// since we may be making it invalid in the canonicalization process.
Status ret = moe::startupOptionsParsed.validate(false/*setValid*/);
if (!ret.isOK()) {
return ret;
}
ret = validateMongosOptions(moe::startupOptionsParsed);
if (!ret.isOK()) {
return ret;
}
ret = canonicalizeMongosOptions(&moe::startupOptionsParsed);
if (!ret.isOK()) {
return ret;
}
ret = moe::startupOptionsParsed.validate();
if (!ret.isOK()) {
return ret;
}
return Status::OK();
}
开发者ID:7segments,项目名称:mongo-1,代码行数:24,代码来源:mongos_options_init.cpp
注:本文中的quickExit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论