diff --git a/notes/README.adatasks b/notes/README.adatasks new file mode 100644 index 0000000..942a25a --- /dev/null +++ b/notes/README.adatasks @@ -0,0 +1,46 @@ + +-ada-task-info [ task-id ] + + +^done,tasks={ + nr_rows="3", + nr_cols="8", + hdr=[ + { + width="1",alignment="-1",col_name="current",colhdr="" + }, + { + width="3",alignment="1",col_name="id",colhdr="ID" + }, + { + width="9",alignment="1",col_name="task-id",colhdr="TID" + }, + { + width="4",alignment="1",col_name="thread-id",colhdr="" + }, + { + width="4",alignment="1",col_name="parent-id",colhdr="P-ID" + }, + { + width="3",alignment="1",col_name="priority",colhdr="Pri" + }, + { + width="22",alignment="-1",col_name="state",colhdr="State" + }, + { + width="1",alignment="2",col_name="name",colhdr="Name" + } + ], + body=[ + { + id="1",task-id="45d030",thread-id="1",priority="48",state="Waiting on RV with 2 ",name="main_task" + }, + { + current="*",id="2",task-id="45de30",thread-id="2",parent-id="1",priority="48",state="Runnable",name="task_a" + }, + { + id="3",task-id="461460",thread-id="3",parent-id="1",priority="48",state="Delay Sleep",name="task_b" + } + ] + } + diff --git a/tests/helloadatasks/.gitignore b/tests/helloadatasks/.gitignore new file mode 100644 index 0000000..c26c559 --- /dev/null +++ b/tests/helloadatasks/.gitignore @@ -0,0 +1,6 @@ +helloadatasks +helloadatasks.ali +helloadatasks.o +b~helloadatasks.* +*.seer +core.* diff --git a/tests/helloadatasks/Makefile b/tests/helloadatasks/Makefile new file mode 100644 index 0000000..bc28982 --- /dev/null +++ b/tests/helloadatasks/Makefile @@ -0,0 +1,11 @@ +.PHONY: all +all: helloadatasks + +helloadatasks: helloadatasks.adb + /usr/bin/gnatmake-9 -g --GNATBIND=/usr/bin/gnatbind-9 --GNATLINK=/usr/bin/gnatlink-9 helloadatasks + +.PHONY: clean +clean: + rm -f helloadatasks helloadatasks.o helloadatasks.ali b~* + +# /usr/bin/gnatmake-9 --GCC=/usr/bin/gcc-9 -g helloadatasks diff --git a/tests/helloadatasks/helloadatasks.adb b/tests/helloadatasks/helloadatasks.adb new file mode 100644 index 0000000..5e98051 --- /dev/null +++ b/tests/helloadatasks/helloadatasks.adb @@ -0,0 +1,53 @@ + +---------------------------------------------------------- +-- This three-task program includes the main procedure, +-- helloadatasks, as the "main task" and two tasks, Task_A and +-- Task_B, nested inside it. +---------------------------------------------------------- + +with Ada.Text_IO, Ada.Calendar; +use Ada.Text_IO, Ada.Calendar; + +procedure helloadatasks is + + Start_Time : constant Time := Clock; + Elapsed_Time : Duration; + + task Task_A is + entry Go; + end Task_A; + + task Task_B is + entry Go; + end Task_B; + + task body Task_A is + begin + delay 2.0; -- relative delay + accept Go; + Elapsed_Time := Clock - Start_Time; + Put_Line("helloadatasks/Task_A Rendezvous occurred at T = " + & Integer'Image(Integer(Elapsed_Time))); + for I in 1..5 loop + delay 2.0; -- relative delay + Task_B.Go; + end loop; + end Task_A; + + task body Task_B is + begin + for I in 1..5 loop + delay until (Start_Time + I*7.0); --absolute delay + accept Go; + Elapsed_Time := Clock - Start_Time; + Put_Line("Task_A/Task_B Rendezvous occurred at T = " + & Integer'Image(Integer(Elapsed_Time))); + end loop; + end Task_B; + +begin + + Task_A.Go; + +end helloadatasks; +