Advertisement
PomozMi

Untitled

Dec 17th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Warstwa1
  8. {
  9.     class Zawiadowca
  10.     {
  11.  
  12.         static public PCB RUNNING; // blok  procesu wykonywanego
  13.         static public PCB NEXTTRY; // zawiadowca ustawia na  nextElement
  14.  
  15.         static public void XPER()// bezpośrednie wywołanie programu zawiadowcy
  16.         {
  17.             do
  18.             {
  19.                 RUNNING = Wybieram();
  20.                // NEXTTRY = RUNNING.nextElement; // 2. w kazeje innej nie ma znaczenia
  21.                
  22.                 if (RUNNING.function_to_run == null)
  23.                 {
  24.                     Warstwa0.AssemblerInterpreter.CPUInterpreter(ref RUNNING);
  25.                 }
  26.                 else
  27.                 {
  28.                     RUNNING.function_to_run(); // 1. jesli w tym warunku bedzie supervisor to on może usunąc wskaznik na nextelement wiec
  29.                 }
  30.                 NEXTTRY = RUNNING.nextElement;
  31.             } while (true);
  32.         }
  33.  
  34.         static public PCB Wybieram() // zawiadowca
  35.         {
  36.             PCB first = NEXTTRY;
  37.             // pętla wyszukująca co mam lecieć
  38.             for (PCB tmp = NEXTTRY; ; tmp = tmp.nextElement)
  39.             {
  40.  
  41.                 if (tmp.BLOCKED == false && tmp.STOPPED == false)
  42.                 {
  43.                     Warstwa5.Program.MainForm.addToList(" Wybieram  " + tmp.NAME);
  44.                     return tmp;
  45.                 }
  46.                 if (tmp.nextElement == first) break;
  47.             }
  48.             return null;
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement