当前位置: 首页>>代码示例>>C++>>正文


C++ JCR::lock方法代码示例

本文整理汇总了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();
}
开发者ID:rkorzeniewski,项目名称:bacula,代码行数:7,代码来源:jcr.c

示例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();
}
开发者ID:janstadler,项目名称:bareos,代码行数:12,代码来源:jcr.c

示例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);
}
开发者ID:tuxmux,项目名称:bareos,代码行数:64,代码来源:status.c

示例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);
}
开发者ID:tuxmux,项目名称:bareos,代码行数:81,代码来源:status.c


注:本文中的JCR::lock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。