本文整理汇总了C++中Shell::doQuit方法的典型用法代码示例。如果您正苦于以下问题:C++ Shell::doQuit方法的具体用法?C++ Shell::doQuit怎么用?C++ Shell::doQuit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shell
的用法示例。
在下文中一共展示了Shell::doQuit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char** argv )
{
bool doUnitTests = 0;
bool doRegressionTests = 0;
unsigned int benchmark = 0;
// This reorders the OpFunc to Fid mapping to ensure it is node and
// compiler independent.
Id shellId = init( argc, argv, doUnitTests, doRegressionTests, benchmark );
// Note that the main loop remains the parser loop, though it may
// spawn a lot of other stuff.
Element* shelle = shellId.element();
Shell* s = reinterpret_cast< Shell* >( shelle->data( 0 ) );
if ( doUnitTests )
nonMpiTests( s ); // These tests do not need the process loop.
if ( Shell::myNode() == 0 ) {
if ( Shell::numNodes() > 1 ) {
// Use the last clock for the postmaster, so that it is called
// after everything else has been processed and all messages
// are ready to send out.
s->doUseClock( "/postmaster", "process", 9 );
s->doSetClock( 9, 1.0 ); // Use a sensible default.
}
#ifdef DO_UNIT_TESTS
if ( doUnitTests ) {
mpiTests();
processTests( s );
}
// if ( doRegressionTests ) regressionTests();
#endif
// These are outside unit tests because they happen in optimized
// mode, using a command-line argument. As soon as they are done
// the system quits, in order to estimate timing.
if ( benchmark != 0 ) {
mooseBenchmarks( benchmark );
s->doQuit();
} else {
// Here we set off a little event loop to poll user input.
// It deals with the doQuit call too.
if(! quitFlag)
Shell::launchParser();
}
} else {
PostMaster* p = reinterpret_cast< PostMaster* >( ObjId( 3 ).data());
while ( Shell::keepLooping() ) {
p->clearPending();
}
}
Msg::clearAllMsgs();
Id::clearAllElements();
#ifdef USE_MPI
MPI_Finalize();
#endif
return 0;
}
示例2: launchParser
/**
* Launches Parser. Blocking when the parser blocks.
*/
void Shell::launchParser()
{
Id shellId;
Shell* s = reinterpret_cast< Shell* >( shellId.eref().data() );
bool quit = 0;
cout << "moose : " << flush;
while ( !quit ) {
string temp;
cin >> temp;
if ( temp == "quit" || temp == "q" ) {
s->doQuit();
quit = 1;
}
}
cout << "\nQuitting Moose\n" << flush;
}