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


C++ msg_t::refcnt方法代码示例

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


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

示例1: close

int zmq::msg_t::copy (msg_t &src_)
{
    //  Check the validity of the source.
    if (unlikely (!src_.check ())) {
        errno = EFAULT;
        return -1;
    }

    int rc = close ();
    if (unlikely (rc < 0))
        return rc;

    if (src_.u.base.type == type_lmsg  ) {

        //  One reference is added to shared messages. Non-shared messages
        //  are turned into shared messages and reference count is set to 2.
        if (src_.u.lmsg.flags & msg_t::shared)
            src_.u.lmsg.content->refcnt.add (1);
        else {
            src_.u.lmsg.flags |= msg_t::shared;
            src_.u.lmsg.content->refcnt.set (2);
        }
    }

    if (src_.is_zcmsg()) {

        //  One reference is added to shared messages. Non-shared messages
        //  are turned into shared messages and reference count is set to 2.
        if (src_.u.zclmsg.flags & msg_t::shared)
            src_.refcnt()->add (1);
        else {
            src_.u.zclmsg.flags |= msg_t::shared;
            src_.refcnt()->set (2);
        }
    }
    if (src_.u.base.metadata != NULL)
        src_.u.base.metadata->add_ref ();

    *this = src_;

    return 0;

}
开发者ID:neon77,项目名称:libzmq,代码行数:43,代码来源:msg.cpp


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