Exemplo n.º 1
0
        private void DividedControlMultiplicationThread()
        {
            IntPoint myTask;

            while (true)
            {
                lock (_lockObj)
                {
                    if (NotDone.Count > 0)
                    {
                        myTask = NotDone.First();
                        NotDone.RemoveAt(0);
                    }
                    else
                    {
                        return;
                    }
                }

                int cell = 0;
                for (int i = 0; i < Ya; i++)
                {
                    cell += A.Matr[myTask.X, i] * B.Matr[i, myTask.Y];
                }

                C.Matr[myTask.X, myTask.Y] = cell;

                ChangeDoneWork(100 - NotDone.Count * 100 / Xa / Yb);
            }
        }
Exemplo n.º 2
0
        private void DividedControlAdditionThread()
        {
            IntPoint myTask;

            while (true)
            {
                lock (_lockObj)
                {
                    if (NotDone.Count > 0)
                    {
                        myTask = NotDone.First();
                        NotDone.RemoveAt(0);
                    }
                    else
                    {
                        return;
                    }

                    /*
                     * if (Thread.CurrentThread.Name == "0")
                     * {
                     *  counter++;
                     * }
                     * if (Thread.CurrentThread.Name == "1")
                     * {
                     *  counterReLoop++;
                     * }
                     */
                }

                C.Matr[myTask.X, myTask.Y] = A.Matr[myTask.X, myTask.Y] + B.Matr[myTask.X, myTask.Y];

                ChangeDoneWork(100 - NotDone.Count * 100 / Xa / Ya);
            }
        }
Exemplo n.º 3
0
        private void ControlThread()
        {
            for (var i = 0; i < Processors - 1; i++)
            {
                if (NotDone.Count == 0)
                {
                    _tasksForSpecialProcessors[i] = new IntPoint()
                    {
                        X = -1, Y = -1
                    }
                }
                ;
                else
                {
                    _tasksForSpecialProcessors[i] = NotDone[0];
                    NotDone.RemoveAt(0);
                }
            }


            for (var i = 0; i < Processors - 1; i++)
            {
                ProcessorsThreads[i] = new Thread(CombinedControlMultiplicationThread)
                {
                    Name = "Thread" + i
                };
                ProcessorsThreads[i].Start();
            }


            while (true)
            {
                for (var i = 0; i < _tasksForSpecialProcessors.Length; i++)
                {
                    if (NotDone.Count == 0)
                    {
                        //ChangeSlider(100);
                        break;
                    }

                    if (_tasksForSpecialProcessors[i].X != -1)
                    {
                        continue;
                    }

                    /*
                     * lock (_lockObjs[i])
                     * {
                     *  _tasksForSpecialProcessors[i] = NotDone[0];
                     * }
                     */

                    _tasksForSpecialProcessors[i] = NotDone[0];
                    NotDone.RemoveAt(0);
                }
            }
        }
Exemplo n.º 4
0
        public IActionResult NotDoneTasks()
        {
            var notDoneTasks = _John.ToDos.Where(t => t.Status == Status.NotDone).ToList();

            NotDone notDone = new NotDone()
            {
                NotDoneTodos = notDoneTasks
            };

            return(View(notDone));
        }
Exemplo n.º 5
0
        public IActionResult NotDoneTasks()
        {
            var notDoneTasks = Db.Users.FirstOrDefault(u => u.FirstName == "John")
                               .ToDos.Where(t => t.Status == Status.NotDone).ToList();

            NotDone notDone = new NotDone()
            {
                NotDoneTodos = notDoneTasks
            };

            return(View(notDone));
        }
Exemplo n.º 6
0
        private void ControlThread()
        {
            for (var i = 0; i < Processors - 1; i++)
            {
                if (NotDone.Count == 0)
                {
                    _tasksForSpecialProcessors[i] = new IntPoint()
                    {
                        X = -1, Y = -1
                    }
                }
                ;
                else
                {
                    _tasksForSpecialProcessors[i] = NotDone[0];
                    NotDone.RemoveAt(0);
                }
            }


            for (var i = 0; i < Processors - 1; i++)
            {
                ProcessorsThreads[i] = new Thread(CombinedControlAdditionThread)
                {
                    Name = "Thread" + i
                };
                ProcessorsThreads[i].Start();
            }

            int j = -1;

            while (true)
            {
                j++;
                if (j == Processors - 1)
                {
                    j = 0;
                }

                if (NotDone.Count == 0)
                {
                    break;
                }

                if (_tasksForSpecialProcessors[j].X == -1)
                {
                    _tasksForSpecialProcessors[j] = NotDone[0];
                    NotDone.RemoveAt(0);
                }
            }
        }
Exemplo n.º 7
0
        private void DividedControlTransposeThread()
        {
            IntPoint myTask;

            while (true)
            {
                lock (_lockObj)
                {
                    if (NotDone.Count > 0)
                    {
                        myTask = NotDone.First();
                        NotDone.RemoveAt(0);
                    }
                    else
                    {
                        return;
                    }
                }

                C.Matr[myTask.Y, myTask.X] = A.Matr[myTask.X, myTask.Y];

                ChangeDoneWork(100 - NotDone.Count * 100 / Xa / Ya);
            }
        }