Advertisement
Guest User

strona6

a guest
May 20th, 2019
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.00 KB | None | 0 0
  1. with Ada.Command_Line, Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO, Ada.Exceptions, Ada.Unchecked_Deallocation, Zadania, Bufor, Semafor_Bin;
  2.  
  3. use Ada.Command_Line, Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO, Ada.Exceptions, Zadania, Bufor, Semafor_Bin;
  4.  
  5. procedure Main is
  6.    
  7.     procedure Free is new Ada.Unchecked_Deallocation
  8.         (Bufor_Obj, Bufor_Obj_Acc);
  9.    
  10.     procedure Free is new Ada.Unchecked_Deallocation
  11.         (Semafor_Bin.Semafor_Bin, Semafor_Bin.Semafor_Bin_Acc);
  12.  
  13.     prod1 : Producent(1);
  14.     prod2 : Producent(2);
  15.     prod3 : Producent(3);
  16.     kons1 : Konsument(1);
  17.     kons2 : Konsument(2);
  18.  
  19. begin
  20.     licnik_prod := 20;
  21.     licnik_kons := 30;
  22.    
  23.     buf_acc := new Bufor_Obj(5);
  24.     sem_bin_acc := new Semafor_Bin.Semafor_Bin(1);
  25.    
  26.     buf_acc.Start;
  27.    
  28.     prod1.Start;
  29.     prod2.Start;
  30.     prod3.Start;
  31.     kons1.Start;
  32.     kons2.Start;
  33.    
  34.     prod1.Stop;
  35.     prod2.Stop;
  36.     prod3.Stop;
  37.     kons1.Stop;
  38.     kons2.Stop;
  39.  
  40.     buf_acc.Stop;
  41.  
  42.     free(buf_acc);
  43.     free(sem_bin_acc);
  44.    
  45.     put("Koniec programu");
  46.     new_line;
  47. end Main;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement