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


C++ OsTime::isInfinite方法代码示例

本文整理汇总了C++中OsTime::isInfinite方法的典型用法代码示例。如果您正苦于以下问题:C++ OsTime::isInfinite方法的具体用法?C++ OsTime::isInfinite怎么用?C++ OsTime::isInfinite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OsTime的用法示例。


在下文中一共展示了OsTime::isInfinite方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: acquire

// Block the task until the mutex is acquired or the timeout expires
OsStatus OsMutexLinux::acquire(const OsTime& rTimeout)
{
   struct timespec timeout;
   OsStatus status;

   if(rTimeout.isInfinite())
   {
      status = (pt_mutex_lock(&mMutexImp) == POSIX_OK) ? OS_SUCCESS : OS_BUSY;
   }
   else if(rTimeout.isNoWait())
   {
      status = (pt_mutex_trylock(&mMutexImp) == POSIX_OK) ? OS_SUCCESS : OS_BUSY;
   }
   else
   {
      OsUtilLinux::cvtOsTimeToTimespec(rTimeout, &timeout);
      status = (pt_mutex_timedlock(&mMutexImp, &timeout) == POSIX_OK)
         ? OS_SUCCESS : OS_WAIT_TIMEOUT;
   }

#ifdef OS_SYNC_DEBUG
   if (status == OS_SUCCESS)
   {
      mSyncCrumbs.dropCrumb(pthread_self(), crumbAcquired);
   }
#endif
   return status;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:29,代码来源:OsMutexLinux.cpp

示例2: acquire

// Block the task until the semaphore is acquired or the timeout expires
OsStatus OsCSemLinux::acquire(const OsTime& rTimeout)
{
   struct timespec timeout;
   OsStatus res;

   if (rTimeout.isInfinite())
      res = (pt_sem_wait(&mSemImp) == POSIX_OK) ? OS_SUCCESS : OS_BUSY;
   else if (rTimeout.isNoWait())
      res = (pt_sem_trywait(&mSemImp) == POSIX_OK) ? OS_SUCCESS : OS_BUSY;
   else
   {
      OsUtilLinux::cvtOsTimeToTimespec(rTimeout, &timeout);
      res = (pt_sem_timedwait(&mSemImp, &timeout) == POSIX_OK) ? OS_SUCCESS : OS_WAIT_TIMEOUT;
   }

#ifdef OS_CSEM_DEBUG
   if (res == OS_SUCCESS)
   {
      updateAcquireStats();
   }
#endif

#ifdef OS_SYNC_DEBUG
   if (res == OS_SUCCESS)
   {
      mSyncCrumbs.dropCrumb(pthread_self(), crumbAcquired);
   }
#endif

   return res;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:32,代码来源:OsCSemLinux.cpp

示例3: enableTimer

// Enable the repeat timer for the designated button.
// A write lock should be acquired before calling this method.
void PsButtonTask::enableTimer(int index)
{
// OsQueuedEvent* pNotifier;
   OsTime         repInterval;
   OsStatus       res;

   if (mpRepTimers[index] != NULL)  // if there already is a repeat timer,
      disableTimer(index);          //  disable it

   mpButtonInfo[index].getRepInterval(repInterval);
   if (repInterval.isInfinite())    // if the repeat interval is infinite,
      return;                       //  don't bother enabling it

   mpRepTimers[index] = new OsTimer(&mIncomingQ, index);
   res = mpRepTimers[index]->periodicEvery(repInterval, repInterval);
   assert(res == OS_SUCCESS);
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:19,代码来源:PsButtonTask.cpp

示例4: synchObjAcquire

// Block the task until the synch obj is acquired or the timeout expires
OsStatus OsUtilWnt::synchObjAcquire(const HANDLE synchObj, 
                                    const OsTime& rTimeout)
{
   DWORD    ntRes;
   DWORD    msecsTimer;
   OsStatus res;

   if (rTimeout.isInfinite())
      msecsTimer = INFINITE;
   else
   {
      assert(OsUtilWnt::isOsTimeValid(rTimeout));
      msecsTimer = OsUtilWnt::cvtOsTimeToWntTime(rTimeout);
   }

   ntRes = WaitForSingleObject(synchObj, msecsTimer);
   switch (ntRes)
   {
   case 0:
      res = OS_SUCCESS;
      break;
   case WAIT_TIMEOUT:
      res = OS_WAIT_TIMEOUT;
      break;
   case WAIT_ABANDONED:
      res = OS_WAIT_ABANDONED;
      break;
   default:
/*
      osPrintf(
         "OsUtilWnt::synchObjAcquire: WaitForSingleObject() returned %d,\n"
         "   GetLastError() = %d"
         "\n\n", ntRes, GetLastError());
*/
      res = OS_UNSPECIFIED;
      break;
   }

   return res;
}
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:41,代码来源:OsUtilWnt.cpp

示例5: doReceive

// Helper function for removing a message from the head of the queue
OsStatus OsMsgQShared::doReceive(OsMsg*& rpMsg, const OsTime& rTimeout)
{
  OsStatus ret;

  if (!rTimeout.isInfinite())
  {
    int expireFromNow = rTimeout.cvtToMsecs();
    if (try_dequeue(rpMsg, expireFromNow))
      ret = OS_SUCCESS;
    else
      ret = OS_WAIT_TIMEOUT;
  }
  else
  {
    dequeue(rpMsg);
    ret = OS_SUCCESS;
  }

   system_tap_queue_dequeue(mName.data(), 0, _queue.size());

   return ret;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:23,代码来源:OsMsgQShared.cpp


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