Commit 21111926 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Add mutual exclusion

parent 544549f2
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Protected block name
@@-- @_Language_@ : Implementation language
@@-- @_Calling_Threads_@ : List of calling threads
@@-- @_Node name_@ : Node name
@@-- @_Provided_@ : Provided interfaces (from pi.tmplt)
@@-- @_Protected_PIs_@ : Protected Provided interfaces (from pi.tmplt)
@@-- @_Unprotected_PIs_@ : Unprotected Provided interfaces (from pi.tmplt)
@@-- @_Required_@ : Required interfaces (from ri.tmplt)
with Interfaces.C;
package @_CAPITALIZE:Name_@_Block is
-- This package interfaces with the user code directly
-- It may contain a protected object if a PI requires mutual exclusion
procedure Init
with Import, Convention => C, Link_Name => "init_@_LOWER:Name_@";
@@IF@@ @_Protected_PIs_@ /= ""
protected @_CAPITALIZE:Name_@_Protected is
@_Protected_PIs'Indent_@
end @_CAPITALIZE:Name_@_Protected;
@@END_IF@@
@_Unprotected_PIs_'Indent_@
end @_CAPITALIZE:Name_@_Block;
......@@ -7,3 +7,13 @@
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@IF@@ @_Param_Names'Length_@ = 0
procedure @_CAPITALIZE:Name_@;
@@ELSE@@
procedure @_CAPITALIZE:Name_@
@@INLINE( \()(;\n )(\);)@@
@@TABLE'ALIGN_ON(":")@@
@_CAPITALIZE:Param_Names_@ : Interfaces.C.char_array; @_CAPITALIZE:Param_Names_@_Size : Integer
@@END_TABLE@@
@@END_INLINE@@
@@END_IF@@
......@@ -3,6 +3,7 @@
@@-- @_Thread_Name_@ : Thread name
@@-- @_Entry_Port_Name_@ : Name of the PI
@@-- @_RCM_@ : One of "CYCLIC_OPERATION", "SPORADIC_OPERATION"
@@-- @_Need_Mutex_@ : True if the PI is shared with others in the protected block
@@-- @_Pro_Block_Name_@ : Name of the protected function
@@-- @_Node_Name_@ : Name of the deployment node
@@-- @_Remote_Threads_@ : Vector tag: output remote thread list
......@@ -23,12 +24,15 @@ with PolyORB_HI_Generated.Types,
use PolyORB_HI_Generated.Deployment,
PolyORB_HI_Generated.Types;
-- with @_CAPITALIZE:Thread_Name_@_Async_RI_Wrappers;
with @_CAPITALIZE:Pro_Block_Name_@_Block;
package @_CAPITALIZE:Thread_Name_@_Wrappers is
-- This package is the interface to PolyORB-HI-Ada for provided interfaces
-- It calls the user code via the protected block that ensures
-- mutual exclusion of the interfaces.
procedure C_Init_@_CAPITALIZE:Thread_Name_@
with Import, Convention => C, Link_Name => "init_@_LOWER:Pro_Block_Name_@";
procedure C_Init_@_CAPITALIZE:Thread_Name_@ renames @_CAPITALIZE:Pro_Block_Name_@_Block.Init;
@@INLINE( )(\n )(\n)@@
@@IF@@ @_Param_Names'Length_@ > 0
......@@ -37,7 +41,6 @@ package @_CAPITALIZE:Thread_Name_@_Wrappers is
@@END_TABLE@@
@@ELSE@@
procedure @_CAPITALIZE:Entry_Port_Name_@ (dummy_Entity : Entity_Type);
procedure @_CAPITALIZE:Pro_Block_Name_@_@_CAPITALIZE:Entry_Port_Name_@ with Import, Convention => C, Link_Name => "@_LOWER:Pro_Block_Name_@_@_LOWER:Entry_Port_Name_@";
@@END_IF@@
@@END_INLINE@@
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment