Ejemplo n.º 1
0
 public void ExecuteTask(IScriptTask task)
 {
     if (Thread.CurrentThread.ManagedThreadId == this._executingThreadId)
     {
         task.Run();
     }
     else
     {
         this._taskQueue.Enqueue(task);
         ExecutingScript._waitEvent.Set();
         ExecutingScript._continueEvent.WaitOne();
     }
 }
Ejemplo n.º 2
0
        public void ExecuteTask(IScriptTask task)
        {
            if (Thread.CurrentThread.ManagedThreadId == _executingThreadId)
            {
                task.Run();
            }
            else
            {
                _taskQueue.Enqueue(task);

                SignalAndWait(ExecutingScript._waitEvent, ExecutingScript._continueEvent);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Execute a script task in this script domain.
        /// </summary>
        /// <param name="task">The task to execute.</param>
        public void ExecuteTask(IScriptTask task)
        {
            if (Thread.CurrentThread.ManagedThreadId == executingThreadId)
            {
                // Request came from the main thread, so can just execute it right away
                task.Run();
            }
            else
            {
                // Request came from the script thread, so need to pass it to the domain thread and execute there
                taskQueue.Enqueue(task);

                SignalAndWait(executingScript.waitEvent, executingScript.continueEvent);
            }
        }