public void Complete(int[] res) { TimerOutput.Print("Клиент выполнил задачу"); lock (dataLock) { subresult[idCount] = res[0]; subresult[idCount + 1] = res[1]; Console.Out.WriteLine(); } if (TaskList.Count == 0) { result[0] = subresult[0]; for (int i = 0; i < 4; i++) { if (subresult[i] < result[0]) { result[0] = subresult[i]; } } result[1] = subresult[0]; for (int i = 0; i < 4; i++) { if (subresult[i] > res[0]) { result[0] = subresult[i]; } } Console.Out.WriteLine(); Console.Out.Write(result[0] + " "); Console.Out.Write(result[1] + " "); Console.Out.WriteLine(); } }
public RemoteObject() { TimerOutput.Print("Инициализация"); TaskList = new Queue <Task>(); tasksLock = new Object(); dataLock = new Object(); manageLock = new object(); }
public int[] getData(Task task) { TimerOutput.Print("Клиент запросил данные "); int[] temp = new int[task.stop - task.start]; int j = 0; for (int i = task.start; i < task.stop; i++) { temp[j] = dataArray[i]; j++; } return(temp); }
public bool setManagingClient() { lock (manageLock) { if (!managed) { managed = true; return(managed); } else { TimerOutput.Print("Задания не сформированы"); return(false); } } }
public Task GetTask() { TimerOutput.Print("Запрос задачи"); lock (tasksLock) { if (TaskList.Count == 0) { TimerOutput.Print("нет готовых задач"); return(null); } else { return(TaskList.Dequeue()); } } }