Exemplo n.º 1
0
        /// <summary>
        /// Signals the manager when a logical
        /// thread has new actions to be processed.
        /// </summary>
        /// <param name="thread">The thread with new actions to be processed.</param>
        /// <param name="priority">The priority at which the thread is being signaled.</param>
        internal void SignalItemHandler(LogicalThread thread, int priority)
        {
            if (thread.TryActivate(priority))
            {
                // Make sure the thread has an action to be processed because
                // another thread could have processed all remaining actions and
                // deactivated the thread right before the call to TryActivate()
                if (!thread.HasAction)
                {
                    thread.Deactivate();
                    return;
                }

                Enqueue(thread);
                ActivatePhysicalThread();
            }
        }