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


C# Msg.Copy方法代码示例

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


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

示例1: CopyPooled

        public void CopyPooled()
        {
            var pool = new MockBufferPool();
            BufferPool.SetCustomBufferPool(pool);

            var msg = new Msg();
            msg.InitPool(100);

            Assert.IsFalse(msg.IsShared);

            var copy = new Msg();
            copy.Copy(ref msg);

            Assert.IsTrue(msg.IsShared);
            Assert.IsTrue(copy.IsShared);

            msg.Close();

            Assert.AreEqual(0, pool.ReturnCallCount);
            Assert.IsFalse(msg.IsInitialised);
            Assert.IsNull(msg.Data);

            copy.Close();

            Assert.AreEqual(1, pool.ReturnCallCount);
            Assert.IsFalse(copy.IsInitialised);
            Assert.IsNull(copy.Data);
        }
开发者ID:wangkai2014,项目名称:netmq,代码行数:28,代码来源:MsgTests.cs

示例2: CopyUninitialisedThrows

        public void CopyUninitialisedThrows()
        {
            var msg = new Msg();

            Assert.IsFalse(msg.IsInitialised);

            var msgCopy = new Msg();
            msgCopy.Copy(ref msg);
        }
开发者ID:wangkai2014,项目名称:netmq,代码行数:9,代码来源:MsgTests.cs

示例3: XAttachPipe

        /// <summary>
        /// Register the pipe with this socket.
        /// </summary>
        /// <param name="pipe">the Pipe to attach</param>
        /// <param name="icanhasall">if true - subscribe to all data on the pipe</param>
        protected override void XAttachPipe(Pipe pipe, bool icanhasall)
        {
            Debug.Assert(pipe != null);
            m_distribution.Attach(pipe);

            // If icanhasall is specified, the caller would like to subscribe
            // to all data on this pipe, implicitly.
            if (icanhasall)
                m_subscriptions.Add(null, 0, 0, pipe);

            // if welcome message was set, write one to the pipe.
            if (m_welcomeMessage.Size > 0)
            {
                var copy = new Msg();
                copy.InitEmpty();
                copy.Copy(ref m_welcomeMessage);

                pipe.Write(ref copy);
                pipe.Flush();
            }

            // The pipe is active when attached. Let's read the subscriptions from
            // it, if any.
            XReadActivated(pipe);
        }
开发者ID:b-cuts,项目名称:netmq,代码行数:30,代码来源:XPub.cs


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