Concurrency Ada中对象的同步Fifo

Concurrency Ada中对象的同步Fifo,concurrency,package,ada,fifo,Concurrency,Package,Ada,Fifo,我在Ada中创建了记录,后来用这些记录创建了同步\u Fifo: type Basic_Record is record Argument_1: Integer; Operator: Character; Argument_2: Integer; Product: Integer; end record; package Tasks_Fifo is new Synchronous_Fifo(Basic_Record); use Tasks_Fifo; Buffer : Fifo

我在Ada中创建了记录,后来用这些记录创建了
同步\u Fifo

type Basic_Record is record
  Argument_1: Integer;
  Operator: Character;
  Argument_2: Integer;
  Product: Integer;
end record;

package Tasks_Fifo is new Synchronous_Fifo(Basic_Record);
use Tasks_Fifo;
Buffer : Fifo;
这很好用。后来我想对对象执行相同的
同步\u Fifo

package Adding_Machine is
  protected type Add_Machine is
     entry Store_Record(Task_Record: Basic_Record);
     entry Push_Button;
     entry Get_Product(Product: out Integer);
  private
     My_Record : Basic_Record;
     My_Product: Integer;
  end Add_Machine;
end Adding_Machine;

use Adding_Machine;

package Object_Fifo is new Synchronous_Fifo(Add_Machine);
use Object_Fifo;
Buffer: Fifo;
结果我犯了几个错误:

Multiple markers at this line
- Occurrence of package
- actual for non-limited "Element_Type" cannot be a limited type
- instantiation abandoned
在行中,我正在创建
对象\u Fifo


我应该如何创建这个Fifo?或者包
添加机器时可能有问题?

下面显示的是包
同步Fifo

generic
     type Element_Type is private;
package Synchronous_Fifo is
  protected type Fifo is
    entry Push(Item : Element_Type);
    entry Pop(Item : out Element_Type);
  private
    Value : Element_Type;
    Is_New : Boolean := False;
  end Fifo;
end Synchronous_Fifo;

package body Synchronous_Fifo is

 ----------
 -- Fifo --
 ----------

 protected body Fifo is

  ---------
  -- Push --
  ---------

  entry Push (Item : Element_Type) when not Is_New is
  begin
     Value := Item;
     Is_New := True;
  end Push;

  ---------
  -- Pop --
  ---------

  entry Pop (Item : out Element_Type) when Is_New is
  begin
     Item := Value;
     Is_New := False;
  end Pop;

 end Fifo;

end Synchronous_Fifo;
我创建了对添加_机器的访问,后来用这些访问创建了Fifo

type Adding_Machine_Access is access Adding_Machine;

package Adding_Machines_Fifo is new Synchronous_Fifo(adding_Machine_Access);
use Tasks_Fifo;
Adding_Machines_Fifo : Fifo;

它应该可以工作。

也许会有帮助?您还没有向我们展示
包同步\u FIFO
的规格。谢谢@SimonWright。这真的很有帮助:)