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


C++ CallbackQueue::begin方法代码示例

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


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

示例1: makePendingCalls

  void RetardedAsyncCallbackHandler::makePendingCalls()
  {
    XBMC_TRACE;
    CSingleLock lock(critSection);
    CallbackQueue::iterator iter = g_callQueue.begin();
    while (iter != g_callQueue.end())
    {
      AddonClass::Ref<AsyncCallbackMessage> p(*iter);

      // only call when we are in the right thread state
      if(p->handler->isStateOk(p->cb->getObject()))
      {
        // remove it from the queue. No matter what we're done with
        //  this. Even if it doesn't execute for some reason.
        g_callQueue.erase(iter);

        // we need to release the critSection lock prior to grabbing the
        //  lock on the object. Not doing so results in deadlocks. We no
        //  longer are accessing the g_callQueue so it's fine to do this now
        {
          XBMCAddonUtils::InvertSingleLockGuard unlock(lock);

          // make sure the object is not deallocating

          // we need to grab the object lock to see if the object of the call 
          //  is deallocating. holding this lock should prevent it from 
          //  deallocating during the execution of this call.
#ifdef ENABLE_XBMC_TRACE_API
          CLog::Log(LOGDEBUG,"%sNEWADDON executing callback 0x%lx",_tg.getSpaces(),(long)(p->cb.get()));
#endif
          AddonClass* obj = (p->cb->getObject());
          AddonClass::Ref<AddonClass> ref(obj);
          CSingleLock lock2(*obj);
          if (!p->cb->getObject()->isDeallocating())
          {
            try
            {
              // need to make the call
              p->cb->executeCallback();
            }
            catch (XbmcCommons::Exception& e) { e.LogThrowMessage(); }
            catch (...)
            {
              CLog::Log(LOGERROR,"Unknown exception while executing callback 0x%lx", (long)(p->cb.get()));
            }
          }
        }

        // since the state of the iterator may have been corrupted by
        //  the changing state of the list from another thread during
        //  the releasing fo the lock in the immediately preceeding 
        //  codeblock, we need to reset it before continuing the loop
        iter = g_callQueue.begin();
      }
      else // if we're not in the right thread for this callback...
        ++iter;
    }  
  }
开发者ID:Elzevir,项目名称:xbmc,代码行数:58,代码来源:CallbackHandler.cpp

示例2: lock

  RetardedAsynchCallbackHandler::~RetardedAsynchCallbackHandler()
  {
    TRACE;
    CSingleLock lock(critSection);

    // find any messages that might be there because of me ... and remove them
    CallbackQueue::iterator iter = g_callQueue.begin();
    while (iter != g_callQueue.end())
    {
      AddonClass::Ref<AsynchCallbackMessage> cur(*iter);
      {
        if (cur->handler == this) // then this message is because of me
        {
          g_callQueue.erase(iter);
          iter = g_callQueue.begin();
        }
        else
          ++iter;
      }
    }
  }
开发者ID:Inferno1977,项目名称:xbmc,代码行数:21,代码来源:CallbackHandler.cpp

示例3: clearPendingCalls

  void RetardedAsynchCallbackHandler::clearPendingCalls(void* userData)
  {
    TRACE;
    CSingleLock lock(critSection);
    CallbackQueue::iterator iter = g_callQueue.begin();
    while (iter != g_callQueue.end())
    {
      AddonClass::Ref<AsynchCallbackMessage> p(*iter);

      if(p->handler->shouldRemoveCallback(userData))
      {
        CLog::Log(LOGDEBUG,"NEWADDON removing callback 0x%lx for PyThreadState 0x%lx from queue", (long)(p->cb.get()) ,(long)userData);
        g_callQueue.erase(iter);
      }
      else
        iter++;
    }  
  }
开发者ID:RobertMe,项目名称:xbmc,代码行数:18,代码来源:CallbackHandler.cpp

示例4: clearPendingCalls

  void RetardedAsynchCallbackHandler::clearPendingCalls(void* userData)
  {
    TRACE;
    CSingleLock lock(critSection);
    CallbackQueue::iterator iter = g_callQueue.begin();
    while (iter != g_callQueue.end())
    {
      AddonClass::Ref<AsynchCallbackMessage> p(*iter);

      if(p->handler->shouldRemoveCallback(p->cb->getObject(),userData))
      {
#ifdef ENABLE_TRACE_API
        CLog::Log(LOGDEBUG,"%sNEWADDON removing callback 0x%lx for PyThreadState 0x%lx from queue", _tg.getSpaces(),(long)(p->cb.get()) ,(long)userData);
#endif
        iter = g_callQueue.erase(iter);
      }
      else
        ++iter;
    }
  }
开发者ID:Inferno1977,项目名称:xbmc,代码行数:20,代码来源:CallbackHandler.cpp


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