Пример #1
0
        private object BlockingInvoke(ReturnDelegate del)
        {
            // Fire off the asynchronous operation
            MessageQueue.BlockingMessage message = new MessageQueue.BlockingMessage(del);
            mMessageQueue.Push(message);
            mHostEvent.Set();

            // Wait for it to finish
            message.AsyncWaitHandle.WaitOne();

            // Return the result, or re-throw the exception
            if (message.Exception != null)
            {
                throw (message.Exception);
            }
            else
            {
                return(message.Result);
            }
        }
Пример #2
0
		private object BlockingInvoke(ReturnDelegate del)
		{
			// Fire off the asynchronous operation
			MessageQueue.BlockingMessage message = new MessageQueue.BlockingMessage(del);
			mMessageQueue.Push(message);
			mHostEvent.Set();

			// Wait for it to finish
			message.AsyncWaitHandle.WaitOne();

			// Return the result, or re-throw the exception
			if (message.Exception != null)
				throw (message.Exception);
			else
				return message.Result;
		}