本文整理汇总了C++中process::clear_running方法的典型用法代码示例。如果您正苦于以下问题:C++ process::clear_running方法的具体用法?C++ process::clear_running怎么用?C++ process::clear_running使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类process
的用法示例。
在下文中一共展示了process::clear_running方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getAndShow
void getAndShow(process &currProcess) {
procinfo pinfo;
switch(get_proc_info(&pinfo, currProcess.get_pid()))
{
case -3: //error condition
//TODO error handling
#ifdef DEBUG
print_string("Not all pinfo values filled");
#endif
break;
case -2: //error condition
#ifdef DEBUG
print_string("Extraneous values, some not read");
#endif
break;
case -1: //error condition
currProcess.clear_keepLogging();
print_string("Error while opening stat file");
break;
case 0: //do nothing
break;
default:
currProcess.clear_keepLogging();
print_string("Unkown exit condition");
break;
}
currProcess.set_pinfo(pinfo);
if(currProcess.get_fname() == "") //use the pid
{
#ifdef DEBUG
print_string("Using PID");
#endif
if(currProcess.get_pname() == "") //set the pname for the log file.
{
#ifdef DEBUG
print_string("Setting pname");
#endif
currProcess.set_pname(pinfo.values[cpu_comm]);
if(currProcess.get_terminalOutput()) //show pname if not set and outputting to terminal
{
print_string(std::to_string(currProcess.get_pid()) + " pname is: " + currProcess.get_pname());
}
}
if(!currProcess.get_terminalOutput()) //don't care about the log file if not logging....
{
#ifdef DEBUG
print_string("Setting logname");
#endif
currProcess.set_fname(currProcess.get_pname()+ "." + pinfo.values[cpu_pid] + ".log");
}
}
//only show logname once, and only if outputting to a log
if(currProcess.get_showOnce() && !currProcess.get_terminalOutput())
{
#ifdef DEBUG
print_string("Show Once, not terminalOutput");
#endif
print_string("Log File: " + currProcess.get_fpath() + currProcess.get_fname());
}
if(pinfo.values[cpu_state] == "D") //D for DEAD
{
#ifdef DEBUG
print_string("DEAD");
#endif
/* No idea what pid will be if it comes back! Execution will never
* stop if search is set and it never comes back. pname should be set
* by now.
* Will continue to search, by pname only.
*/
currProcess.set_pid(0);
currProcess.clear_running();
if(!currProcess.get_search()) {
currProcess.clear_keepLogging();
}
}
currProcess.clear_showOnce();
currProcess.outputData();
}