Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.38 KB | None | 0 0
  1. type textFile = monitor;
  2. var N, actualN = 0 : Integer;
  3. var x : condition;
  4. var temp : Integer;
  5.  
  6. procedure entry ENTER
  7. begin
  8.   when actualN < N
  9.     x.wait();
  10.   actualN := actualN + i.ID;
  11. end;
  12.  
  13. procedure entry LEAVE
  14. begin
  15.   actualN := actualN - i.ID;
  16.   x.signal();
  17. end;
  18.  
  19.  
  20. procedure process
  21. begin
  22.   textFile.ENTER;
  23.  
  24.   // WORK ON FILE
  25.  
  26.   textFile.LEAVE;
  27. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement