本文整理汇总了C++中JCR::use_count方法的典型用法代码示例。如果您正苦于以下问题:C++ JCR::use_count方法的具体用法?C++ JCR::use_count怎么用?C++ JCR::use_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCR
的用法示例。
在下文中一共展示了JCR::use_count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Given a JobId, find the JCR
* Returns: jcr on success
* NULL on failure
*/
JCR *get_jcr_by_id(uint32_t JobId)
{
JCR *jcr;
foreach_jcr(jcr) {
if (jcr->JobId == JobId) {
jcr->inc_use_count();
Dmsg3(dbglvl, "Inc get_jcr jid=%u use_count=%d Job=%s\n",
jcr->JobId, jcr->use_count(), jcr->Job);
break;
}
}
endeach_jcr(jcr);
return jcr;
}
示例2: dbg_print_jcr
/*
* !!! WARNING !!!
*
* This function should be used ONLY after a fatal signal. We walk through the
* JCR chain without doing any lock, BAREOS should not be running.
*/
void dbg_print_jcr(FILE *fp)
{
char buf1[128], buf2[128], buf3[128], buf4[128];
if (!jcrs) {
return;
}
fprintf(fp, "Attempt to dump current JCRs. njcrs=%d\n", jcrs->size());
for (JCR *jcr = (JCR *)jcrs->first(); jcr ; jcr = (JCR *)jcrs->next(jcr)) {
#ifdef HAVE_WIN32
fprintf(fp, "threadid=%p JobId=%d JobStatus=%c jcr=%p name=%s\n",
(void *)&jcr->my_thread_id, (int)jcr->JobId,
jcr->JobStatus, jcr, jcr->Job);
fprintf(fp, "threadid=%p killable=%d JobId=%d JobStatus=%c "
"jcr=%p name=%s\n",
(void *)&jcr->my_thread_id, jcr->is_killable(),
(int)jcr->JobId, jcr->JobStatus, jcr, jcr->Job);
#else
fprintf(fp, "threadid=%p JobId=%d JobStatus=%c jcr=%p name=%s\n",
(void *)jcr->my_thread_id, (int)jcr->JobId,
jcr->JobStatus, jcr, jcr->Job);
fprintf(fp, "threadid=%p killable=%d JobId=%d JobStatus=%c "
"jcr=%p name=%s\n",
(void *)jcr->my_thread_id, jcr->is_killable(),
(int)jcr->JobId, jcr->JobStatus, jcr, jcr->Job);
#endif
fprintf(fp, "\tuse_count=%i\n", jcr->use_count());
fprintf(fp, "\tJobType=%c JobLevel=%c\n",
jcr->getJobType(), jcr->getJobLevel());
bstrftime(buf1, sizeof(buf1), jcr->sched_time);
bstrftime(buf2, sizeof(buf2), jcr->start_time);
bstrftime(buf3, sizeof(buf3), jcr->end_time);
bstrftime(buf4, sizeof(buf4), jcr->wait_time);
fprintf(fp, "\tsched_time=%s start_time=%s\n\tend_time=%s wait_time=%s\n",
buf1, buf2, buf3, buf4);
fprintf(fp, "\tdb=%p db_batch=%p batch_started=%i\n",
jcr->db, jcr->db_batch, jcr->batch_started);
/*
* Call all the jcr debug hooks
*/
for(int i=0; i < dbg_jcr_handler_count; i++) {
dbg_jcr_hook_t *hook = dbg_jcr_hooks[i];
hook(jcr, fp);
}
}
}
示例3:
/*
* Given a SessionId and SessionTime, find the JCR
*
* Returns: jcr on success
* NULL on failure
*/
JCR *get_jcr_by_session(uint32_t SessionId, uint32_t SessionTime)
{
JCR *jcr;
foreach_jcr(jcr) {
if (jcr->VolSessionId == SessionId &&
jcr->VolSessionTime == SessionTime) {
jcr->inc_use_count();
Dmsg3(dbglvl, "Inc get_jcr jid=%u use_count=%d Job=%s\n",
jcr->JobId, jcr->use_count(), jcr->Job);
break;
}
}
endeach_jcr(jcr);
return jcr;
}
示例4: strlen
/*
* Given a Job, find the JCR compares on the number of
* characters in Job thus allowing partial matches.
*
* Returns: jcr on success
* NULL on failure
*/
JCR *get_jcr_by_partial_name(char *Job)
{
JCR *jcr;
int len;
if (!Job) {
return NULL;
}
len = strlen(Job);
foreach_jcr(jcr) {
if (bstrncmp(Job, jcr->Job, len)) {
jcr->inc_use_count();
Dmsg3(dbglvl, "Inc get_jcr jid=%u use_count=%d Job=%s\n",
jcr->JobId, jcr->use_count(), jcr->Job);
break;
}
}
endeach_jcr(jcr);
return jcr;
}
示例5: allow_duplicate_job
//.........这里部分代码省略.........
/*
* See if this Job has the IgnoreDuplicateJobChecking flag set, ignore it
* for any checking against other jobs.
*/
if (djcr->IgnoreDuplicateJobChecking) {
continue;
}
if (bstrcmp(job->name(), djcr->res.job->name())) {
if (job->DuplicateJobProximity > 0) {
utime_t now = (utime_t)time(NULL);
if ((now - djcr->start_time) > job->DuplicateJobProximity) {
continue; /* not really a duplicate */
}
}
if (job->CancelLowerLevelDuplicates &&
djcr->getJobType() == 'B' && jcr->getJobType() == 'B') {
switch (jcr->getJobLevel()) {
case L_FULL:
if (djcr->getJobLevel() == L_DIFFERENTIAL ||
djcr->getJobLevel() == L_INCREMENTAL) {
cancel_dup = true;
}
break;
case L_DIFFERENTIAL:
if (djcr->getJobLevel() == L_INCREMENTAL) {
cancel_dup = true;
}
if (djcr->getJobLevel() == L_FULL) {
cancel_me = true;
}
break;
case L_INCREMENTAL:
if (djcr->getJobLevel() == L_FULL ||
djcr->getJobLevel() == L_DIFFERENTIAL) {
cancel_me = true;
}
}
/*
* cancel_dup will be done below
*/
if (cancel_me) {
/* Zap current job */
jcr->setJobStatus(JS_Canceled);
Jmsg(jcr, M_FATAL, 0, _("JobId %d already running. Duplicate job not allowed.\n"),
djcr->JobId);
break; /* get out of foreach_jcr */
}
}
/*
* Cancel one of the two jobs (me or dup)
* If CancelQueuedDuplicates is set do so only if job is queued.
*/
if (job->CancelQueuedDuplicates) {
switch (djcr->JobStatus) {
case JS_Created:
case JS_WaitJobRes:
case JS_WaitClientRes:
case JS_WaitStoreRes:
case JS_WaitPriority:
case JS_WaitMaxJobs:
case JS_WaitStartTime:
cancel_dup = true; /* cancel queued duplicate */
break;
default:
break;
}
}
if (cancel_dup || job->CancelRunningDuplicates) {
/*
* Zap the duplicated job djcr
*/
UAContext *ua = new_ua_context(jcr);
Jmsg(jcr, M_INFO, 0, _("Cancelling duplicate JobId=%d.\n"), djcr->JobId);
cancel_job(ua, djcr);
bmicrosleep(0, 500000);
djcr->setJobStatus(JS_Canceled);
cancel_job(ua, djcr);
free_ua_context(ua);
Dmsg2(800, "Cancel dup %p JobId=%d\n", djcr, djcr->JobId);
} else {
/*
* Zap current job
*/
jcr->setJobStatus(JS_Canceled);
Jmsg(jcr, M_FATAL, 0, _("JobId %d already running. Duplicate job not allowed.\n"),
djcr->JobId);
Dmsg2(800, "Cancel me %p JobId=%d\n", jcr, jcr->JobId);
}
Dmsg4(800, "curJobId=%d use_cnt=%d dupJobId=%d use_cnt=%d\n",
jcr->JobId, jcr->use_count(), djcr->JobId, djcr->use_count());
break; /* did our work, get out of foreach loop */
}
}
endeach_jcr(djcr);
return true;
}