本文整理汇总了C++中Extension::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ Extension::clone方法的具体用法?C++ Extension::clone怎么用?C++ Extension::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Extension
的用法示例。
在下文中一共展示了Extension::clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mainLoop
int ManagerClass::mainLoop()
{
int retval ;
pid_t pid = 0 ;
bool execed = false;
/*
* Loop until there's no monitored process left.
*/
while_begin:
while (process_count > 0) {
/* wait for next call */
SystemCall theCall ;
#ifdef MEASURE_TIME
struct tms start_tms ;
times(&start_tms) ;
#endif
retval = arch->waitForCall(&pid, &theCall);
#ifdef MEASURE_TIME
struct tms end_tms ;
times(&end_tms) ;
#endif
if (NEXTCALL_ERROR == retval)
continue ;
MonitoredProc *supObj = monitoringTable.lookUp(pid) ;
if (0 == supObj) {
cerr << "ManagerClass: No record of process!" << endl ;
continue ;
}
execed = false;
switch (retval) {
case NEXTCALL_EXITED:
process_count -- ;
// set the exit flag, so that destructor of MP won't kill it again
supObj->setExitFlag();
monitoringTable.remove(pid) ;
goto while_begin ;
break ;
case NEXTCALL_CREATED:
/* alloc a new monitoring object for new process */
/* ASSUMPTION: new pid is returned by return value */
if (!theCall.isEntry()) {
int errnum ;
long childpid = arch->getReturnVal(pid, &errnum) ;
MonitoredProc *childObj = new MonitoredProc(this) ;
if (0 == childObj) {
cerr <<"ManagerClass: Cannot alloc MonitoredProc!" << endl;
arch->terminateProc(childpid) ;
return -1 ;
}
childObj->pid(childpid) ;
childObj->programName(supObj->programName()) ;
childObj->mapFileName(supObj->mapFileName()) ;
supObj->resetExtensionList() ;
Extension *pExtension ;
while ((pExtension=supObj->getNextExtension()) != 0) {
Extension *ext = pExtension->clone() ;
childObj->insertExtension(ext) ;
}
monitoringTable.insert(childpid, childObj) ;
process_count ++ ;
}
break ;
case NEXTCALL_EXECED:
execed = true;
break ;
default:
break ;
}
#ifdef MEASURE_TIME
long scno = theCall.scno() ;
user_time[scno] += end_tms.tms_utime - start_tms.tms_utime ;
sys_time[scno] += end_tms.tms_stime - start_tms.tms_stime ;
call_count[scno] ++ ;
#endif
/* deliver this event to the Extensions */
/* The Extensions are arranged as layers, i.e., the first Extension at the
entry point is the last Extension at the exit point */
if (switch_on_exec) {
if (execed)
if (theCall.isEntry()) {
CString exec(theCall.getArgRep(0)) ;
supObj->programTemp(exec.get().c_str()) ;
}
}
supObj->setCurCall(&theCall) ;
Extension *pExtension ;
supObj->resetExtensionList() ;
while (true) {
if (theCall.isEntry())
pExtension = supObj->getNextExtension() ;
else
//.........这里部分代码省略.........