private Run ( ThreadStart, userDelegate, ApartmentState, apartmentState ) : void | ||
userDelegate | ThreadStart, | |
apartmentState | ApartmentState, | |
Résultat | void |
protected override void OnPreProcess(object sender, PreProcessEventArgs args) { int threadID = AppDomain.GetCurrentThreadId(); if(runningThreads[threadID]!=null || runningThreads.Count>0) { OutputDebugMessage("skipping method run from inside previous runner..."); return ; } else { runningThreads[threadID]="some not null value"; } OutputDebugMessage(threadID + ": Preparing to run method on separate thread and join it afterwards..."); CrossThreadRunner runner = new CrossThreadRunner(args.TargetObject,args.MethodCallMessage.MethodBase,args.MethodCallMessage.Args); runner.Run(); OutputDebugMessage("Ran it on a separate thread...skipping actual method invocation on current thread"); this.FlagCurrentMethodToBeSkipped(args); }