gpt4 book ai didi

interrupt - Ada - pragma Attach_Handler() 是否可以附加具有 System.Priority'Last 优先级的处理程序?

转载 作者:行者123 更新时间:2023-12-04 06:39:04 26 4
gpt4 key购买 nike

接下来的两个声明是等价的:

protected type prot_Type is
....
pragma Priority(System.Priority'Last);
end;


protected type prot_Type is
....
end;

附加中断处理程序的一种方法是:
 protected type prot_Type is
procedure Handler;
pragma Attach_Handler(Handler, ...);
end;

--//Attach is made at the creation of the next object:
Object : prot_Type;

这是一个合法的附件(它有效)。

处理程序的上限优先级怎么可能是 System.Priority最后的 ? (据我所知,合法优先级在 Priority'Last+1 .. Any_Priority'Last 范围内)。

另一件事:
如果我添加 pragma Priority(System.Priority'Last);对于 protected 声明,在细化时(附加处理程序时)会引发 program_error 异常。

有人可以请散布雾吗?

最佳答案

由于以下原因,我终于理解了:
http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/node33.htm

在 protected 优先级 System.Priority'Last 中定义的 hadler 设法附加到中断这一事实在我看来就像编译器中的错误。

只有在 Interrupt_Prioriy'Range 中的 protected 最高优先级中定义的处理程序才能附加到中断。

另一件重要的事情 - 对于非静态 protected (即用“ protected 类型......”声明),附件是通过创建该类型的对象来完成的。必须分配对象 动态 .

约尼。

关于interrupt - Ada - pragma Attach_Handler() 是否可以附加具有 System.Priority'Last 优先级的处理程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4497404/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com