Ejemplo n.º 1
0
        private void HandleTask()
        {
            IProcTask task = _tasksCells.Dequeue();

            task.Work();
            _statistics.HandledTask++;
        }
Ejemplo n.º 2
0
        public bool TryAddTaskIfEmptyCell(IProcTask task)
        {
            _statistics.InputTask++;
            bool isProcCanWork = isProcessorCanWork();

            if (!isProcCanWork)
            {
                return(false);
            }

            if (_tasksCells.Count < _maxTask)
            {
                _tasksCells.Enqueue(task);
            }
            else
            {
                _statistics.LostedTask++;
            }

            return(true);
        }