BeginInvokeMethod() 공개 메소드

public BeginInvokeMethod ( ThreadMirror thread, Mono.Debugger.Soft.MethodMirror method, IList arguments, InvokeOptions options, AsyncCallback callback, object state ) : IAsyncResult
thread ThreadMirror
method Mono.Debugger.Soft.MethodMirror
arguments IList
options InvokeOptions
callback AsyncCallback
state object
리턴 IAsyncResult
예제 #1
0
 public IAsyncResult BeginInvokeMethod(ThreadMirror thread, MethodMirror method, IList <Value> arguments, InvokeOptions options, AsyncCallback callback, object state)
 {
     return(ObjectMirror.BeginInvokeMethod(vm, thread, method, null, arguments, options, callback, state));
 }
예제 #2
0
        private Value DoInvoke(ThreadMirror thread, ObjectMirror obj, string name)
        {
            Value result;

            MethodMirror method = obj.Type.ResolveProperty(name);
            if (method == null)
                method = obj.Type.FindMethod(name, 0);

            if (method != null)
            {
                if (!Debugger.IsTypeLoaded(method.DeclaringType.FullName))
                {
                    result = thread.Domain.CreateString("type not loaded");
                }
                else
                {
                    IAsyncResult ar = obj.BeginInvokeMethod(thread, method, new Value[0], InvokeOptions.DisableBreakpoints | InvokeOptions.SingleThreaded, null, null);

                    if (!ar.IsCompleted)
                        ar.AsyncWaitHandle.WaitOne(Timeout);

                    if (ar.IsCompleted)
                    {
                        result = obj.EndInvokeMethod(ar);
                    }
                    else
                    {
                        Func<Value> getter = () => obj.EndInvokeMethod(ar);
                        ThreadPool.QueueUserWorkItem(o => DoIgnoreResult(getter, ar));	// the pool uses background threads so the app will exit even if this thread is still running
                        result = thread.Domain.CreateString("timed out");
                    }
                }
            }
            else
            {
                throw new Exception(string.Format("Couldn't find a property for {0}.{1}", obj.Type.FullName, name));
            }

            return result;
        }