Example #1
0
        private void UpdateWorkingSet()
        {
            lblStatus6.Text = _smartThreadPool.IsIdle ? "Idle" : "Working";

            object [] statesWorking = null;
            lock (_workingStates.SyncRoot)
            {
                statesWorking = new object[_workingStates.Count];
                _workingStates.Keys.CopyTo(statesWorking, 0);
            }

            object[] statesSTP = _smartThreadPool.GetStates();
            List <QueueUsageControl.QueueUsageEntry> list = new List <QueueUsageControl.QueueUsageEntry>();

            foreach (QueueUsageControl.QueueUsageEntry entry in statesWorking)
            {
                if (null != entry)
                {
                    entry.IsExecuting = true;
                    list.Add(entry);
                }
            }

            foreach (object[] state in statesSTP)
            {
                if (null != state)
                {
                    list.Add(((WorkItemState)state[0]).QueueUsageEntry);
                }
            }

            queueUsageControl6.SetQueue(list);
        }