本文整理汇总了C++中HR_INFO::accept方法的典型用法代码示例。如果您正苦于以下问题:C++ HR_INFO::accept方法的具体用法?C++ HR_INFO::accept怎么用?C++ HR_INFO::accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HR_INFO
的用法示例。
在下文中一共展示了HR_INFO::accept方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_job_from_db
//.........这里部分代码省略.........
if (retval != ERR_DB_NOT_FOUND) {
// If DB server dies, exit;
// so /start (run from crontab) will restart us eventually.
//
log_messages.printf(MSG_CRITICAL,
"DB connection lost, exiting\n"
);
exit(0);
}
// we've reach the end of the result set
//
switch (enum_phase) {
case ENUM_FIRST_PASS:
enum_phase = ENUM_SECOND_PASS;
ncollisions = 0;
// disregard collisions - maybe we'll find new jobs
break;
case ENUM_SECOND_PASS:
enum_phase = ENUM_OVER;
return false;
}
log_messages.printf(MSG_NORMAL,
"restarted enumeration for appid %lu\n",
ssp->apps[app_index].id
);
} else {
// Check for invalid application ID
//
if (!ssp->lookup_app(wi.wu.appid)) {
#if 0
log_messages.printf(MSG_CRITICAL,
"result [RESULT#%u] has bad appid %d; clean up your DB!\n",
wi.res_id, wi.wu.appid
);
#endif
continue;
}
// if the WU had an error, mark result as DIDNT_NEED
//
if (wi.wu.error_mask) {
char buf[256];
DB_RESULT result;
result.id = wi.res_id;
sprintf(buf, "server_state=%d, outcome=%d",
RESULT_SERVER_STATE_OVER,
RESULT_OUTCOME_DIDNT_NEED
);
result.update_field(buf);
log_messages.printf(MSG_NORMAL,
"[RESULT#%lu] WU had error, marking as DIDNT_NEED\n",
wi.res_id
);
continue;
}
// Check for collision (i.e. this result already is in the array)
//
collision = false;
for (j=0; j<ssp->max_wu_results; j++) {
if (ssp->wu_results[j].state != WR_STATE_EMPTY && ssp->wu_results[j].resultid == wi.res_id) {
// If the result is already in shared mem,
// and another instance of the WU has been sent,
// bump the infeasible count to encourage
// it to get sent more quickly
//
if (ssp->wu_results[j].infeasible_count == 0) {
if (wi.wu.hr_class > 0) {
ssp->wu_results[j].infeasible_count++;
}
}
ncollisions++;
collision = true;
log_messages.printf(MSG_DEBUG,
"result [RESULT#%lu] already in array\n", wi.res_id
);
break;
}
}
if (collision) {
continue;
}
// if using HR, check whether we've exceeded quota for this class
//
if (hrt && config.hr_allocate_slots) {
if (!hr_info.accept(hrt, wi.wu.hr_class)) {
log_messages.printf(MSG_DEBUG,
"rejecting [RESULT#%lu] because HR class %d/%d over quota\n",
wi.res_id, hrt, wi.wu.hr_class
);
continue;
}
}
return true;
}
}
return false; // never reached
}