コード例 #1
0
        /// <summary>
        /// Create an IO handler.
        /// </summary>
        /// <remarks>
        /// If the underlying infrastructure does not support the requested mamaIoType,
        /// create throws MamaException(MAMA_STATUS_UNSUPPORTED_IO_TYPE). For example,
        /// RV only supports READ, WRITE, and EXCEPT. LBM supports all types except ERROR
        /// </remarks>
        /// <param name="queue">The event queue for the io events. null specifies the
        /// Mama default queue</param>
        /// <param name="action">The callback to be invoked when an event occurs.</param>
        /// <param name="descriptor">Wait for IO on this descriptor.</param>
        /// <param name="ioType">Wait for occurences of this type.</param>
        /// <param name="closure">The closure that is passed to the callback.</param>
        public void create(
            MamaQueue queue,
            MamaIoCallback action,
            uint descriptor,
            mamaIoType ioType,
            object closure)
        {
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (action == null)
            {
                throw new ArgumentNullException("action");
            }
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            this.callback      = action;
            this.closureObject = closure;

            IntPtr queueHandle = queue != null ? queue.NativeHandle : IntPtr.Zero;
            int    code        = NativeMethods.mamaIo_create(
                ref nativeHandle,
                queueHandle,
                descriptor,
                mIoDelegate,
                (int)ioType,
                IntPtr.Zero);
            CheckResultCode(code);

            GC.KeepAlive(queue);
        }
コード例 #2
0
 /// <summary>
 /// CLS compliant version of create
 /// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/>
 /// </summary>
 public void create(
     MamaQueue queue,
     MamaIoCallback action,
     long descriptor,
     mamaIoType ioType)
 {
     create(queue, action, descriptor, ioType, null);
 }
コード例 #3
0
        /// <summary>
        /// CLS compliant version of create
        /// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/>
        /// </summary>
        public void create(
            MamaQueue queue,
            MamaIoCallback action,
            long descriptor,
            mamaIoType ioType,
            object closure)
        {
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
            if (descriptor < 0 || descriptor > UInt32.MaxValue)
            {
                throw new ArgumentOutOfRangeException("descriptor", descriptor);
            }
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
            create(queue, action, (uint)descriptor, ioType, closure);
        }
コード例 #4
0
ファイル: MamaIo.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// Create an IO handler.
		/// </summary>
		/// <remarks>
		/// If the underlying infrastructure does not support the requested mamaIoType,
		/// create throws MamaException(MAMA_STATUS_UNSUPPORTED_IO_TYPE). For example,
		/// RV only supports READ, WRITE, and EXCEPT. LBM supports all types except ERROR
		/// </remarks>
		/// <param name="queue">The event queue for the io events. null specifies the
		/// Mama default queue</param>
		/// <param name="action">The callback to be invoked when an event occurs.</param>
		/// <param name="descriptor">Wait for IO on this descriptor.</param>
		/// <param name="ioType">Wait for occurences of this type.</param>
		/// <param name="closure">The closure that is passed to the callback.</param>
		public void create(
			MamaQueue queue,
			MamaIoCallback action, 
			uint descriptor,
			mamaIoType ioType,
			object closure)
		{
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
			if (action == null)
			{
				throw new ArgumentNullException("action");
			}
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
			this.callback = action;
			this.closureObject = closure;

			IntPtr queueHandle = queue != null ? queue.NativeHandle : IntPtr.Zero;
			int code = NativeMethods.mamaIo_create(
				ref nativeHandle, 
				queueHandle, 
				descriptor, 
				mIoDelegate,
				(int)ioType,
				IntPtr.Zero);
			CheckResultCode(code);
			
			GC.KeepAlive(queue);
		}
コード例 #5
0
ファイル: MamaIo.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// CLS compliant version of create
		/// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/>
		/// </summary>
		public void create(
			MamaQueue queue,
			MamaIoCallback action, 
			long descriptor,
			mamaIoType ioType)
		{
			create(queue, action, descriptor, ioType, null);
		}
コード例 #6
0
ファイル: MamaIo.cs プロジェクト: jacobraj/MAMA
		/// <summary>
		/// CLS compliant version of create
		/// <see cref="create(MamaQueue, MamaIoCallback, uint, mamaIoType, System.Object)"/>
		/// </summary>
		public void create(
			MamaQueue queue,
			MamaIoCallback action, 
			long descriptor,
			mamaIoType ioType,
			object closure)
		{
#if MAMA_WRAPPERS_CHECK_ARGUMENTS
			if (descriptor < 0 || descriptor > UInt32.MaxValue)
			{
				throw new ArgumentOutOfRangeException("descriptor", descriptor);
			}
#endif // MAMA_WRAPPERS_CHECK_ARGUMENTS
			create(queue, action, (uint)descriptor, ioType, closure);
		}