Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted by chuj ( 14 years ago )
program DIJKSTRA;
2. begin
3. shared
4. flag[1..n]: 0..2;
5. turn : 1..n;
6. local
7. testi : 0..2;
8. k, otheri, tempi: 1..n;
9. while True do
10. begin
11. L: flag[i]:=1;
12. otheri:=turn;
13. while otheri¹i do
14. begin
15. testi:=flag[otheri];
16. if testi=0 then
17. turn:=i;
18. otheri:=turn;
19. end;
20. flag[i]:=2;
21. for k:=1 to n do
22. if k¹i then
23. begin
24. testi:=flag[k];
25 if testi=2 then
26. goto L;
27. end;
28. criticalSection;
29. flag[i]:=0;
30. reminderSection;
31. end;
32. end.

 

Revise this Paste

Your Name: Code Language: