Ada 中止语句
我试图中止ada程序中的任务,但在编译过程中出现以下错误:Ada 中止语句,ada,gnat,Ada,Gnat,我试图中止ada程序中的任务,但在编译过程中出现以下错误: expect task name or task interface class-wide object for "abort" 代码如下所示: task type Sending_Message; type Send_Message is access Sending_Message; declare send : Send_Message; begin send := new Sending_Message
expect task name or task interface class-wide object for "abort"
代码如下所示:
task type Sending_Message;
type Send_Message is access Sending_Message;
declare
send : Send_Message;
begin
send := new Sending_Message;
...
abort send; -- this line throws error
end;
abort Sending_Message;
当我再次尝试这样的路线时:
task type Sending_Message;
type Send_Message is access Sending_Message;
declare
send : Send_Message;
begin
send := new Sending_Message;
...
abort send; -- this line throws error
end;
abort Sending_Message;
我得到一个错误:
invalid use of subtype mark in expression or call
知道怎么回事吗?您必须明确取消对访问类型的引用:
abort send.all;
必须显式取消引用访问类型:
abort send.all;