1
우선이 문제를 해결할 수 있습니다. 저는 Ada에서 초보자입니다. 제가 이것을 할 수 있기를 원하는 이유는 우선 순위 반전을 프로그램하고 싶기 때문입니다. Ada. 런타임에 작업 우선 순위를 설정하는 방법?
내가 포함했다
,with Ada.Task_Identification;
나는 또한 작업 유형 만들었 :
task type tasktype1 is
pragma PRIORITY (20);
entry gotosleep;
end tasktype1;
을 나는 작업 선언 :
High : tasktype1;
지금 내가 변경하려면를 작업의 우선 순위를 "높음"으로 설정합니다.
내가 시도 쓰기 : 나는 주의에 넣어 것
High.Prority(1);
블록을 시작합니다.
및 Task_ID가 선언되었습니다.
A : Task_Id;
는
A := Current_Task;
와 현재 작업을 가져 오기 위해 노력하고 다음 주에 Priority(3,A);
대신 시작했습니다. 여기
with Ada.Text_IO, Ada.Integer_Text_IO, System, Ada.Task_Identification;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Main is
task type tasktype1 is
pragma PRIORITY (20);
entry gotosleep;
end tasktype1;
pragma PRIORITY (3); -- This is the priority for the main program
High : tasktype1;
A : Task_Id;
task body tasktype1 is
begin
accept gotosleep do
Put("Cow is not sleeping");
end gotosleep;
end tasktype1;
begin
A := Current_Task;
Priority(3, A);
Put_Line("This is an example of use of a task type");
Put_Line("This is an example of use of a task type");
Put_Line("This is an example of use of a task type");
Put_Line("This is an example of use of a task type");
Put_Line("This is an example of use of a task type");
end Main;
'Ada.Dynamic_Priorities'를 사용하여 런타임에 작업 우선 순위를 설정할 수 있습니다. Set_Priority' - [ARM D.5.1] (http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-D-5-1.html)을 참조하십시오 (참고로 하위 프로그램'Priority'에는 당신이 원하는 프로파일!) –