本文整理汇总了C++中ACTIVE_TASK::handle_exited_app方法的典型用法代码示例。如果您正苦于以下问题:C++ ACTIVE_TASK::handle_exited_app方法的具体用法?C++ ACTIVE_TASK::handle_exited_app怎么用?C++ ACTIVE_TASK::handle_exited_app使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACTIVE_TASK
的用法示例。
在下文中一共展示了ACTIVE_TASK::handle_exited_app方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_app_exited
// See if any processes have exited
//
bool ACTIVE_TASK_SET::check_app_exited() {
//LOGD("app_control: ACTIVE_TASK_SET::check_app_exited");
ACTIVE_TASK* atp;
bool found = false;
#ifdef _WIN32
unsigned long exit_code;
unsigned int i;
for (i=0; i<active_tasks.size(); i++) {
atp = active_tasks[i];
if (!atp->process_exists()) continue;
if (GetExitCodeProcess(atp->process_handle, &exit_code)) {
if (exit_code != STILL_ACTIVE) {
found = true;
atp->handle_exited_app(exit_code);
}
} else {
if (log_flags.task_debug) {
char errmsg[1024];
msg_printf(atp->result->project, MSG_INFO,
"[task] task %s GetExitCodeProcess() failed - %s GLE %d (0x%x)",
atp->result->name,
windows_format_error_string(
GetLastError(), errmsg, sizeof(errmsg)
),
GetLastError(), GetLastError()
);
}
// The process doesn't seem to be there.
// Mark task as aborted so we don't check it again.
//
atp->set_task_state(PROCESS_ABORTED, "check_app_exited");
}
}
#else
int pid, stat;
if ((pid = waitpid(-1, &stat, WNOHANG)) > 0) {
atp = lookup_pid(pid);
if (!atp) {
// if we're running benchmarks, exited process
// is probably a benchmark process; don't show error
//
if (!gstate.are_cpu_benchmarks_running() && log_flags.task_debug) {
msg_printf(NULL, MSG_INTERNAL_ERROR,
"Process %d not found\n", pid
);
}
return false;
}
atp->handle_exited_app(stat);
found = true;
}
#endif
return found;
}