本文整理汇总了C++中Owned::doit方法的典型用法代码示例。如果您正苦于以下问题:C++ Owned::doit方法的具体用法?C++ Owned::doit怎么用?C++ Owned::doit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owned
的用法示例。
在下文中一共展示了Owned::doit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, const char* argv[])
{
InitModuleObjects();
if ((argc >= 2) && ((stricmp(argv[1], "/version") == 0) || (stricmp(argv[1], "-v") == 0)
|| (stricmp(argv[1], "--version") == 0)))
{
printVersion();
return 0;
}
Owned<IFile> inifile = createIFile("dfuplus.ini");
if(argc < 2 && !(inifile->exists() && inifile->size() > 0))
{
handleSyntax();
return 0;
}
if ((argc >= 2) && ((argv[1][0]=='/' || argv[1][0]=='-') && (argv[1][1]=='?' || argv[1][1]=='h')))
{
handleSyntax();
return 0;
}
//queryLogMsgManager()->changeMonitorFilterOwn(queryStderrLogMsgHandler(), getPassNoneLogMsgFilter());
Owned<IProperties> globals = createProperties("dfuplus.ini", true);
if(!build_globals(argc, argv, globals))
{
fprintf(stderr, "ERROR: Invalid command syntax.\n");
releaseAtoms();
return DFUERR_InvalidCommandSyntax;
}
const char* action = globals->queryProp("action");
if(!action || !*action)
{
handleSyntax();
fprintf(stderr, "\nERROR: please specify one action");
releaseAtoms();
return DFUERR_TooFewArguments;
}
const char* server = globals->queryProp("server");
if (!server || !*server) {
if (stricmp(action,"dafilesrv")==0)
globals->setProp("server","127.0.0.1"); // dummy
else {
fprintf(stderr, "ERROR: Esp server url not specified.\n");
releaseAtoms();
return DFUERR_TooFewArguments;
}
}
try
{
Owned<CDfuPlusHelper> helper = new CDfuPlusHelper(LINK(globals.get()));
helper->doit();
}
catch(IException* e)
{
StringBuffer errmsg;
e->errorMessage(errmsg);
fprintf(stderr, "%s\n", errmsg.str());
}
releaseAtoms();
return 0;
}
示例2: doSubmitWorkUnit
//.........这里部分代码省略.........
StringBuffer msg;
excep->errorMessage(msg);
printf("%s\n", msg.str());
return false;
}
printf("Workunit %s submitted\n", wuid);
}
// Wait for the results (or not)
bool infinite = true;
int timeout = -1;
if(globals->hasProp("timeout"))
{
infinite = false;
timeout = globals->getPropInt("timeout", 0)*1000;
}
bool compileOnly = globals->getPropInt("compileOnly", 0)!=0;
bool returnOnWaitState = globals->getPropInt("returnOnWait", 0)!=0;
if(timeout > 0 || infinite)
{
if (compileOnly)
{
Owned<IClientWUWaitRequest> req = wuclient->createWUWaitCompiledRequest();
req->setWuid(wuid);
req->setWait(timeout);
req->setReturnOnWait(returnOnWaitState);
Owned<IClientWUWaitResponse> resp = wuclient->WUWaitCompiled(req);
WUState s = (WUState)resp->getStateID();
return s == WUStateCompiled;
}
else
{
WUState s;
int initial_wait = 30;
int polling_period = 30;
int waited = 0;
int actual_wait = -1;
while(1)
{
if(actual_wait != 0)
{
// Initially, wait initial_wait
actual_wait = infinite?initial_wait*1000: std::min(timeout, initial_wait*1000);
}
Owned<IClientWUWaitRequest> req = wuclient->createWUWaitCompleteRequest();
req->setWuid(wuid);
req->setWait(actual_wait);
Owned<IClientWUWaitResponse> resp = wuclient->WUWaitComplete(req);
const IMultiException* excep = &resp->getExceptions();
if(excep != NULL && excep->ordinality() > 0)
{
StringBuffer msg;
excep->errorMessage(msg);
printf("%s\n", msg.str());
return false;
}
s = (WUState)resp->getStateID();
if (s != WUStateUnknown)
break;
if(actual_wait != 0)
{
waited += actual_wait;
actual_wait = 0;
if (!infinite && (waited >= timeout))
break;
}
else
{
if (!infinite && (waited >= timeout))
break;
int time_to_wait = infinite?polling_period*1000: std::min(timeout - waited, polling_period*1000);
sleep(time_to_wait/1000);
waited += time_to_wait;
}
}
if (s != WUStateUnknown)
{
globals->setProp("wuid", wuid);
if(format)
LINK(format);
Owned<IEclPlusHelper> viewer = new ViewHelper(LINK(globals), format);
viewer->doit(fp);
}
return ((s == WUStateCompleted) || (returnOnWaitState && (s == WUStateWait)));
}
}
else
{
StringBuffer s;
s.append("Submitted WUID ").append(wuid);
fprintf(fp, "%s", s.str());
return true;
}
}