📄 main.adb
字号:
with Protected_Variables;with Ada.Text_IO; use Ada.Text_IO;with Semaphores; use Semaphores;procedure Main is I: Protected_Variables.Item := Protected_Variables.Red; S: Semaphore(Start_Count => 10); type Cell; type Cell_Ptr is access Cell; type Cell is record I: Integer; end record; L: Cell_Ptr := new Cell'(I=>37); N: Cell_Ptr := new Cell'(I=>56);begin Put_Line(Protected_Variables.Item'Image(I)); Protected_Variables.Protected_Variable.Write(I); Put_Line(Protected_Variables.Item'Image(I)); Protected_Variables.Protected_Variable.Read(I); I := Protected_Variables.Green; Put_Line(Protected_Variables.Item'Image(I)); Protected_Variables.Protected_Variable.Write(I); I := Protected_Variables.Blue; Protected_Variables.Protected_Variable.Read(I); Put_Line(Protected_Variables.Item'Image(I)); -- Semaphore Locks for I in Integer Range 1..10 loop S.Secure; end loop; for I in Integer Range 1..10 loop S.Release; end loop; L := N; Put_Line(Integer'Image(L.I)); Put_Line(Integer'Image(N.I));end Main;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -