⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 externallockimpl.ipp

📁 最新的版本ACE-5.6.8,刚从外文网上搬下,与大家分享.
💻 IPP
字号:
// file      : Utility/ReferenceCounting/ExternalLockImpl.ipp
// author    : Boris Kolpackov <boris@kolpackov.net>
// copyright : Copyright (c) 2002-2003 Boris Kolpackov
// license   : http://kolpackov.net/license.html

namespace Utility
{
  namespace ReferenceCounting
  {
    /*
    inline
    ExternalLockRefCounter::ExternalLockRefCounter (ACE_Lock* lock)
        : lock_ (lock),
          ref_count_ (1)
    {
    }

    inline
    void
    ExternalLockRefCounter::init (ACE_Lock* lock)
    {
      lock_ = lock;
    }

    inline
    ExternalLockRefCounter::~ExternalLockRefCounter ()
    {
    }

    inline
    ACE_Lock*
    ExternalLockRefCounter::lock_i ()
    {
      return lock_;
    }

    inline
    void
    ExternalLockRefCounter::_add_ref ()
    {
      if (lock_)
      {
        Guard_ guard (*lock_);
        _add_ref_i ();
      }
      else
      {
        _add_ref_i ();
      }
    }

    inline
    void
    ExternalLockRefCounter::_remove_ref ()
    {
      bool destroy = false;
      {
        if (lock_)
        {
          Guard_ guard (*lock_);
          destroy = _remove_ref_i ();
        }
        else
        {
          destroy = _remove_ref_i ();
        }
      }
      if (destroy) delete this;
    }

    inline
    unsigned long
    ExternalLockRefCounter::_refcount_value ()
    {
      if (lock_)
      {
        Guard_ guard (*lock_);
        return _refcount_value_i ();
      }
      else
      {
        return _refcount_value_i ();
      }
    }

    inline
    void
    ExternalLockRefCounter::_add_ref_i ()
    {
      ref_count_++;
    }

    inline
    bool
    ExternalLockRefCounter::_remove_ref_i ()
    {
      bool destroy = false;
      if (ref_count_ > 0)
      {
        if (--ref_count_ == 0) destroy = true;
      }
      else
      {
        ACE_ERROR ((LM_ERROR,
                    "ExternalLockRefCounter::_remove_ref() "
                    " _remove_ref() called while ref_coundt == 0\n"
                   ));
      }
      return destroy;
    }

    inline
    unsigned long
    ExternalLockRefCounter::_refcount_value_i ()
    {
      return ref_count_;
    }
    */
  }
}

//$Id: ExternalLockImpl.ipp 80826 2008-03-04 14:51:23Z wotte $

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -