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


C# MamaMsg.SelfManageLifeTime方法代码示例

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


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

示例1: getMsg

        /// <summary>
        /// Get a submessage.
        /// </summary>
        public MamaMsg getMsg(
			string name, 
			ushort fid)
        {
            if (msg_ == null)
            {
                msg_ = new MamaMsg ();
                msg_.SelfManageLifeTime(false);
            }
            tryMsgImpl(name, fid, ref msg_, true);
            return msg_;
        }
开发者ID:OpenMAMA,项目名称:OpenMAMA,代码行数:15,代码来源:MamaMsg.cs

示例2: sendFromInboxWithThrottle

		/// <summary>
		/// Send a p2p message from the specified inbox using the throttle.
		/// The lifecycle of the message sent is controlled by the user of the API. The
		/// callback indicates when the API is no longer using the message and can be
		/// destroyed/reused by the application.
		/// </summary>
		/// <param name="inbox">The MamaInbox which will process any response to the sent message.</param>
		/// <param name="message">The MamaMsg to send.</param>
		/// <param name="callback">The callback which will be invoked when the message
		/// is sent from the throttle queue.</param>
		/// <param name="closure">User supplied data returned when the callback is invoked.</param>
		public void sendFromInboxWithThrottle(
			MamaInbox inbox,
			MamaMsg message,
			MamaSendCompleteCallback callback,
			object closure)
		{
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
			if (inbox == null)
			{
				throw new ArgumentNullException("inbox");
			}
			if (message == null)
			{
				throw new ArgumentNullException("message");
			}
			if (callback == null)
			{
				throw new ArgumentNullException("callback");
			}
			EnsurePeerCreated();
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS

            // Create a new callback wrapper
            MamaCallbackWrapper<MamaSendCompleteCallback, MamaThrottledSendCompleteDelegate> wrapper =
                new MamaCallbackWrapper<MamaSendCompleteCallback, MamaThrottledSendCompleteDelegate>(
                    callback,
                    closure,
                    new MamaThrottledSendCompleteDelegate(onSendComplete));

            // Add this to the store
            IntPtr nativeClosure = mCallbackStore.StoreWrapper(wrapper);

			// Call the native function
			int code = NativeMethods.mamaPublisher_sendFromInboxWithThrottle(
				nativeHandle,
                inbox.NativeHandle,
				message.NativeHandle, 
                (Wombat.MamaPublisher.MamaThrottledSendCompleteDelegate)wrapper.NativeDelegate,
                nativeClosure);
			try
			{
				CheckResultCode(code);
			}

            // If something goes wrong then remove the wrapper from the store
			catch
			{
                // Remove the wrapper
                mCallbackStore.RemoveWrapper(nativeClosure);

                // Dispose it
                ((IDisposable)wrapper).Dispose();
                
                // Rethrow the exception
				throw;
			}
		
            // Ensure that the message passed will not delete its native peer
            message.SelfManageLifeTime(false);
		}
开发者ID:jacobraj,项目名称:MAMA,代码行数:71,代码来源:MamaPublisher.cs


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