本文整理汇总了C++中JCR::lock方法的典型用法代码示例。如果您正苦于以下问题:C++ JCR::lock方法的具体用法?C++ JCR::lock怎么用?C++ JCR::lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JCR
的用法示例。
在下文中一共展示了JCR::lock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_killable
void JCR::set_killable(bool killable)
{
JCR *jcr = this;
jcr->lock();
jcr->my_thread_killable = killable;
jcr->unlock();
}
示例2: set_killable
void JCR::set_killable(bool killable)
{
JCR *jcr = this;
jcr->lock();
jcr->my_thread_killable = killable;
if (killable) {
jcr->my_thread_id = pthread_self();
} else {
memset(&jcr->my_thread_id, 0, sizeof(jcr->my_thread_id));
}
jcr->unlock();
}
示例3: list_running_jobs_api
static void list_running_jobs_api(STATUS_PKT *sp)
{
JCR *njcr;
int len, sec, bps;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH], b1[32], b2[32], b3[32], b4[32];
/*
* List running jobs for Bat/Bweb (simple to parse)
*/
foreach_jcr(njcr) {
bstrutime(dt, sizeof(dt), njcr->start_time);
if (njcr->JobId == 0) {
len = Mmsg(msg, "DirectorConnected=%s\n", dt);
} else {
len = Mmsg(msg, "JobId=%d\n Job=%s\n",
njcr->JobId, njcr->Job);
sendit(msg, len, sp);
#ifdef WIN32_VSS
len = Mmsg(msg," VSS=%d\n Level=%c\n JobType=%c\n JobStarted=%s\n",
(njcr->pVSSClient && njcr->pVSSClient->IsInitialized()) ? 1 : 0,
njcr->getJobLevel(), njcr->getJobType(), dt);
#else
len = Mmsg(msg," VSS=%d\n Level=%c\n JobType=%c\n JobStarted=%s\n",
0, njcr->getJobLevel(), njcr->getJobType(), dt);
#endif
}
sendit(msg, len, sp);
if (njcr->JobId == 0) {
continue;
}
sec = time(NULL) - njcr->start_time;
if (sec <= 0) {
sec = 1;
}
bps = (int)(njcr->JobBytes / sec);
len = Mmsg(msg, " Files=%s\n Bytes=%s\n Bytes/sec=%s\n Errors=%d\n"
" Bwlimit=%s\n",
edit_uint64(njcr->JobFiles, b1),
edit_uint64(njcr->JobBytes, b2),
edit_uint64(bps, b3),
njcr->JobErrors, edit_int64(njcr->max_bandwidth, b4));
sendit(msg, len, sp);
len = Mmsg(msg, " Files Examined=%s\n",
edit_uint64(njcr->num_files_examined, b1));
sendit(msg, len, sp);
if (njcr->JobFiles > 0) {
njcr->lock();
len = Mmsg(msg, " Processing file=%s\n", njcr->last_fname);
njcr->unlock();
sendit(msg, len, sp);
}
if (njcr->store_bsock) {
len = Mmsg(msg, " SDReadSeqNo=%" lld "\n fd=%d\n",
njcr->store_bsock->read_seqno, njcr->store_bsock->m_fd);
sendit(msg, len, sp);
} else {
len = Mmsg(msg, _(" SDSocket=closed\n"));
sendit(msg, len, sp);
}
}
endeach_jcr(njcr);
}
示例4: list_running_jobs_plain
static void list_running_jobs_plain(STATUS_PKT *sp)
{
JCR *njcr;
int len, sec, bps;
bool found = false;
POOL_MEM msg(PM_MESSAGE);
char dt[MAX_TIME_LENGTH], b1[32], b2[32], b3[32], b4[32];
/*
* List running jobs
*/
Dmsg0(1000, "Begin status jcr loop.\n");
len = Mmsg(msg, _("\nRunning Jobs:\n"));
sendit(msg, len, sp);
foreach_jcr(njcr) {
bstrftime_nc(dt, sizeof(dt), njcr->start_time);
if (njcr->JobId == 0) {
len = Mmsg(msg, _("Director connected at: %s\n"), dt);
} else {
len = Mmsg(msg, _("JobId %d Job %s is running.\n"),
njcr->JobId, njcr->Job);
sendit(msg, len, sp);
#ifdef WIN32_VSS
len = Mmsg(msg, _(" %s%s %s Job started: %s\n"),
(njcr->pVSSClient && njcr->pVSSClient->IsInitialized()) ? "VSS " : "",
level_to_str(njcr->getJobLevel()),
job_type_to_str(njcr->getJobType()), dt);
#else
len = Mmsg(msg, _(" %s %s Job started: %s\n"),
level_to_str(njcr->getJobLevel()),
job_type_to_str(njcr->getJobType()), dt);
#endif
}
sendit(msg, len, sp);
if (njcr->JobId == 0) {
continue;
}
sec = time(NULL) - njcr->start_time;
if (sec <= 0) {
sec = 1;
}
bps = (int)(njcr->JobBytes / sec);
len = Mmsg(msg, _(" Files=%s Bytes=%s Bytes/sec=%s Errors=%d\n"
" Bwlimit=%s\n"),
edit_uint64_with_commas(njcr->JobFiles, b1),
edit_uint64_with_commas(njcr->JobBytes, b2),
edit_uint64_with_commas(bps, b3),
njcr->JobErrors,
edit_uint64_with_commas(njcr->max_bandwidth, b4));
sendit(msg, len, sp);
len = Mmsg(msg, _(" Files Examined=%s\n"),
edit_uint64_with_commas(njcr->num_files_examined, b1));
sendit(msg, len, sp);
if (njcr->JobFiles > 0) {
njcr->lock();
len = Mmsg(msg, _(" Processing file: %s\n"), njcr->last_fname);
njcr->unlock();
sendit(msg, len, sp);
}
found = true;
if (njcr->store_bsock) {
len = Mmsg(msg, " SDReadSeqNo=%" lld " fd=%d\n",
njcr->store_bsock->read_seqno, njcr->store_bsock->m_fd);
sendit(msg, len, sp);
} else {
len = Mmsg(msg, _(" SDSocket closed.\n"));
sendit(msg, len, sp);
}
}
endeach_jcr(njcr);
if (!found) {
len = Mmsg(msg, _("No Jobs running.\n"));
sendit(msg, len, sp);
}
len = pm_strcpy(msg, _("====\n"));
sendit(msg, len, sp);
}