示例#1
0
 public override void QueueTask(JsTask task)
 {
     newTaskEvent.Reset();
     lock (tasks)
         _ = tasks.AddLast(task);
     newTaskEvent.Set();
 }
示例#2
0
        private void ExecutionThread()
        {
            bool   shouldStayAlive    = true;
            JsTask currentlyExecuting = null;

            while (shouldStayAlive)
            {
                if (currentlyExecuting == null)
                {
                    lock (tasks)
                    {
                        currentlyExecuting = FirstToExecute();
                    }
                }

                if (currentlyExecuting != null)
                {
                    currentlyExecuting.Run();
                    currentlyExecuting = null;
                }
                else
                {
                    lock (aliveLock)
                        shouldStayAlive = alive;
                    if (shouldStayAlive)
                    {
                        newTaskEvent.WaitOne();
                    }
                }
            }
        }
示例#3
0
 public JsTaskAwaiter(JsTask task)
 {
     _task = task;
 }
示例#4
0
 public abstract void QueueTask(JsTask task);