예제 #1
0
        /// <summary>
        /// Resume all waiting <see cref="DesTask"/>s specifying the activator and
        /// the activation data.
        /// </summary>
        /// <param name="activator">The activator.</param>
        /// <param name="data">The activation data.</param>
        protected virtual void ResumeAll(object activator, object data)
        {
            int nWaiting = BlockCount;

            if (nWaiting > 1)
            {
                DesTask[] blockedDesTasks = new DesTask[nWaiting];
                WaitQueue.CopyTo(blockedDesTasks, 0);
                WaitQueue.Clear();
                for (int i = 0; i < nWaiting; i++)
                {
                    DesTask desTask = blockedDesTasks[i];
                    if (!desTask.Canceled)
                    {
                        ResumeTask(desTask, activator, data);
                    }
                }
            }
            else if (nWaiting == 1)
            {
                ResumeNext(activator, data);
            }
        }