Exemplo n.º 1
0
        /// <summary>
        /// Enqueue a WorkItem entry for processing.
        /// </summary>
        /// <param name="processor"></param>
        /// <param name="item"></param>
        /// <param name="del"></param>
        public void Enqueue(IWorkItemProcessor processor, WorkItem item, WorkItemThreadDelegate del)
        {
            var parameter = new WorkItemThreadParameter(processor, item, del);

            lock (_syncLock)
            {
                if (item.Priority.Equals(WorkItemPriorityEnum.Stat))
                {
                    _statPriorityCount++;
                }

                _totalThreadCount++;

                _queuedItems.Add(parameter);
            }

            Enqueue(parameter, delegate(WorkItemThreadParameter threadParameter)
            {
                threadParameter.Delegate(threadParameter.Processor, threadParameter.Item);

                ThreadComplete(threadParameter.Item);
            });
        }
Exemplo n.º 2
0
 public WorkItemThreadParameter(IWorkItemProcessor processor, WorkItem item, WorkItemThreadDelegate del)
 {
     _item      = item;
     _processor = processor;
     _del       = del;
 }