Advertisement
Guest User

Untitled

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