public static int ForwardEvent(MamaQueueEventCallback callback, object closure, IntPtr nativeHandle, MamaQueue sender) { // Create a new forwarder object to manage the .Net callback objects EnqueueEventForwarder forwarder = new EnqueueEventForwarder(callback, closure, sender); /* Invoke the native method, the index into the array will be passed as the clousure. */ return(NativeMethods.mamaQueue_enqueueEvent(nativeHandle, forwarder.NativeCallback, new IntPtr(forwarder.mIndex))); }
/// <summary> /// Constructor initialises all member variables. /// </summary> /// <param name="callback"> /// The callback object that will be invoked whenever an event is processed. /// </param> /// <param name="closure"> /// Utility object. /// </param> /// <param name="sender"> /// The queue. /// </param> public EnqueueEventForwarder(MamaQueueEventCallback callback, object closure, MamaQueue sender) { // Save arguments in member variables. mCallback = callback; mClosure = closure; mSender = sender; // Save a reference to this object in the static list mIndex = AddForwarder(this); }
/// <summary> /// This function will enqueue an event on the mama queue. /// </summary> /// <param name="callback"> /// This callback will be invoked by the thread pumping the queue. /// </param> /// <param name="closure"> /// Utility object that will be passed back to the callback. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown if the callback object is null. /// </exception> public void enqueueEvent(MamaQueueEventCallback callback, object closure) { // Verify that the callback object has been supplied if (callback == null) { throw new ArgumentNullException("callback"); } // Make sure the queue has been created EnsurePeerCreated(); // Create a new forwarder object to manage the .Net callback objects int code = EnqueueEventForwarder.ForwardEvent(callback, closure, nativeHandle, this); // Chek that the return code CheckResultCode(code); }
public static int ForwardEvent(MamaQueueEventCallback callback, object closure, IntPtr nativeHandle, MamaQueue sender) { // Create a new forwarder object to manage the .Net callback objects EnqueueEventForwarder forwarder = new EnqueueEventForwarder(callback, closure, sender); /* Invoke the native method, the index into the array will be passed as the clousure. */ return NativeMethods.mamaQueue_enqueueEvent(nativeHandle, forwarder.NativeCallback, new IntPtr(forwarder.mIndex)); }
/// <summary> /// This function will enqueue an event on the mama queue. /// </summary> /// <param name="callback"> /// This callback will be invoked by the thread pumping the queue. /// </param> /// <param name="closure"> /// Utility object that will be passed back to the callback. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown if the callback object is null. /// </exception> public void enqueueEvent(MamaQueueEventCallback callback, object closure) { // Verify that the callback object has been supplied if(callback == null) { throw new ArgumentNullException("callback"); } // Make sure the queue has been created EnsurePeerCreated(); // Create a new forwarder object to manage the .Net callback objects int code = EnqueueEventForwarder.ForwardEvent(callback, closure, nativeHandle, this); // Chek that the return code CheckResultCode(code); }