public void Invoke(ActionShim @delegate)
        {
            StartThread();

            // create the task
            var task = new Task(@delegate);

            // we don't want the task to be completed before we start waiting for that, so the outer lock
            lock (task)
            {
                lock (queueLock)
                {
                    taskQueue.Add(task);

                    Monitor.Pulse(queueLock);
                }

                // until this point, evaluation could not start
                Monitor.Wait(task);

                if (task.Exception != null)
                {
                    throw task.Exception;
                }
            }
        }
 public Task(ActionShim action)
 {
     this.Action = action;
 }
Esempio n. 3
0
 public Task(ActionShim action)
 {
     Action = action;
 }