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

标签 interrupt ada protected

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

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 Last ? (据我所知,合法优先级的范围为 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 类型...”声明),附件是通过创建该类型的对象来创建的。该对象必须动态分配。

约尼。

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

相关文章:

Ada:循环导致后面的代码无法访问

random - Ada 随机数是相同的

ada - 如何在Windows下分发GtkAda应用程序?

c# - 在 C# 中是否可以使用内部 AND protected 成员?

c++ - Windows - protected 共享内存

interrupt - 无法弄清楚如何使用 SDCC 为 Z80 编写中断处理程序

java - 线程中断有时有效有时无效

python - Raspberry Pi 中断 Python(GPIO 库)

ruby - 在 Ruby 测试中避免 protected 级别的访问器和相等方法