Implementation Note:
{AI12-0119-1}
{AI12-0436-1}
Although each sequence_of_statements
of a parallel block represents a separate logical thread of control,
the implementation may choose to combine two or more such logical threads
of control into a single physical thread of control to reduce the cost
of creating numerous physical threads of control.
{AI12-0119-1}
{AI12-0404-1}
procedure Traverse (T : Expr_Ptr) is -- see 3.9.1 begin if T /= nulland then
T.allin Binary_Operation'Class -- see 3.9.1 then -- recurse down the binary tree parallel do
Traverse (T.Left); and
Traverse (T.Right); and
Ada.Text_IO.Put_Line
("Processing " & Ada.Tags.Expanded_Name (T'Tag)); end do; end if; end Traverse;
{AI12-0119-1}
function Search (S : String; Char : Character) return Boolean is begin if S'Length <= 1000 then
-- Sequential scan return (forsome C of S => C = Char); else
-- Parallel divide and conquer declare
Mid : constant Positive := S'First + S'Length/2 - 1; begin parallel do for C of S(S'First .. Mid) loop if C = Char then return True; -- Terminates enclosing do end if; end loop; and for C of S(Mid + 1 .. S'Last) loop if C = Char then return True; -- Terminates enclosing do end if; end loop; end do;
-- Not found return False; end; end if; end Search;