コード例 #1
0
        /// <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);
        }