当前位置: 首页>>代码示例>>C++>>正文


C++ Extension::deliverEvent方法代码示例

本文整理汇总了C++中Extension::deliverEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ Extension::deliverEvent方法的具体用法?C++ Extension::deliverEvent怎么用?C++ Extension::deliverEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Extension的用法示例。


在下文中一共展示了Extension::deliverEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mainLoop


//.........这里部分代码省略.........
		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 
		pExtension = supObj->getPrevExtension() ;
	    if (0 == pExtension) 
		break ;
	    
	    bool nextWait = false ;
	    int retval = pExtension->deliverEvent() ;
	    switch (retval) {
	    case EXTENSION_ABORT:
		/* kill this process and wait for the next event */
		nextWait = true ;
		arch->terminateProc(pid) ;
		process_count -- ;
		break ;
	    case EXTENSION_ACCEPT:
		/* detach this process and wait for the next event */
		nextWait = true ;
		arch->detachProc(pid) ;
		process_count -- ;
		break ;
	    default:
		break ;
	    }
	    if (nextWait)
		break ;

	    if (supObj->switchExt()) {
		Extension *newExt=createExtension(supObj->lib(), 
						  supObj->monClass());
		if (0 != newExt)
		    supObj->replaceExtension(pExtension, newExt) ; 
		supObj->switchExt(false) ;
	    }
	}

	if (switch_on_exec) {
	    if (execed)
		if (!theCall.isEntry()) {
		    int err ; 
		    if (arch->getReturnVal(pid, &err)==0) {
			supObj->changeProg() ;
			if (setupExtensions(supObj->mapFileName(), 
					    supObj->programName(), supObj)< 0){
			    cerr << "ManagerClass: Extension setup error!" << endl ;
			    return -1 ;
			}
		    }
		
		}
	}

    }

    return 0 ;
}
开发者ID:bhushanjain,项目名称:cse508,代码行数:101,代码来源:ManagerClass.cpp


注:本文中的Extension::deliverEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。