Exemplo n.º 1
0
 public LogicalThread(int threadId, string threadName, StateManager stateManager)
 {
     this.threadId   = threadId;
     this.callStack  = new Stack <VirtualStackFrame>();
     this.controller = new ThreadWorkerController();
     this.controller.Initialize(threadName + "." + threadId.ToString(CultureInfo.InvariantCulture), stateManager);
 }
Exemplo n.º 2
0
 public static void IslandWorker(ThreadWorkerController controller)
 {
     if (controller == null)
     {
         throw FxTrace.Exception.ArgumentNull(nameof(controller));
     }
     controller.Worker(true);
 }
 public static void IslandWorker(ThreadWorkerController controller)
 {
     if (controller == null)
     {
         throw FxTrace.Exception.ArgumentNull("controller");
     }
     controller.Worker(true);
 }
Exemplo n.º 4
0
        // Common helper to invoke an Stack frame.
        // This handles marshaling the args.
        // islandArguments - arbitrary argument passed ot the islands.
        // [DebuggerHidden]
        internal void InvokeWorker(object islandArguments, VirtualStackFrame stackFrame)
        {
            State state = stackFrame.State;

            if (!state.DebuggingEnabled)
            {
                // We need to short circuit and call IslandWorker because that is what the generated code
                // would have done, if we had generated it. This causes the thread to finish up.
                ThreadWorkerController.IslandWorker((ThreadWorkerController)islandArguments);
                return;
            }

            MethodInfo methodInfo = this.dynamicModuleManager.GetIsland(state, this.IsPriming);
            IDictionary <string, object> allLocals = stackFrame.Locals;

            // Package up the raw arguments array.
            const int numberOfBaseArguments = 2;
            int       numberOfEarlyLocals   = state.NumberOfEarlyLocals;

            object[] arguments = new object[numberOfBaseArguments + numberOfEarlyLocals]; // +1 for IslandArguments and +1 for IsPriming
            arguments[0] = this.IsPriming;
            arguments[1] = islandArguments;
            if (numberOfEarlyLocals > 0)
            {
                int i = numberOfBaseArguments;
                foreach (LocalsItemDescription localsItemDescription in state.EarlyLocals)
                {
                    string name = localsItemDescription.Name;
                    object value;
                    if (allLocals.TryGetValue(name, out value))
                    {
                        // We could assert that val.GetType() is assignable to localsItemDescription.Type.
                        // MethodInfo invoke will check this anyways; but we could check
                        // it and give a better error.
                    }
                    else
                    {
                        // Local not supplied in the array! Use a default.
                        value = Activator.CreateInstance(localsItemDescription.Type);
                    }
                    arguments[i] = value;
                    i++;
                }
            }
            methodInfo.Invoke(null, arguments);
        }
Exemplo n.º 5
0
 public LogicalThread(int threadId, string threadName, StateManager stateManager)
 {
     this.threadId = threadId;
     this.callStack = new Stack<VirtualStackFrame>();
     this.controller = new ThreadWorkerController();
     this.controller.Initialize(threadName + "." + threadId.ToString(CultureInfo.InvariantCulture), stateManager);
 }
Exemplo n.º 6
0
 public static void IslandWorker(ThreadWorkerController controller)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
		public static void IslandWorker (ThreadWorkerController controller)
		{
			throw new NotImplementedException ();
		}