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


C++ Proxy::remove方法代码示例

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


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

示例1: remove_void

void ListenersBase::remove_void (void* const listener)
{
  ReadWriteMutex::ScopedWriteLockType lock (m_groups_mutex);

  // Make sure the listener exists
#if VF_DEBUG
  {
    bool exists = false;

    for (Groups::iterator iter = m_groups.begin(); iter != m_groups.end();)
    {
      Group* group = &(*iter++);

      // this should never happen while we hold the mutex
      jassert (!group->empty ());

      if (group->contains (listener))
      {
        jassert (!exists); // added twice?

        exists = true;
        // keep going to make sure there are no empty groups
      }
    }

    jassert (exists);
  }
#endif

  // Find the group and remove
  for (Groups::iterator iter = m_groups.begin(); iter != m_groups.end();)
  {
    Group::Ptr group = &(*iter++);

    // If the listener is in there, take it out.
    if (group->remove (listener))
    {
      // Are we the last listener?
      if (group->empty ())
      {
        // Tell proxies to remove the group
        {
          ReadWriteMutex::ScopedWriteLockType lock (m_proxies_mutex);

          for (Proxies::iterator iter = m_proxies.begin (); iter != m_proxies.end ();)
          {
            Proxy* proxy = &(*iter++);
            proxy->remove (group);
          }
        }

        // Remove it from the list and manually release
        // the reference since the list uses raw pointers.
        m_groups.erase (m_groups.iterator_to (*group.getObject ()));
        group->decReferenceCount();

        // It is still possible for the group to exist at this
        // point in a thread queue but it will get processed,
        // do nothing, and release its own final reference.
      }

      break;
    }
  }
}
开发者ID:ZECTBynmo,项目名称:VFLib,代码行数:65,代码来源:vf_Listeners.cpp


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