- spike/run.sh riproduce la prova: hello Ada, i 19 file del motore compilati per ARM, motore che legge una Maildir vera, tasking con protected object - esito: binari compatibili con la glibc di Sailfish 5.1 (max 2.34) - resta: link con libetpan/gpgme/jansson, sysroot del telefono
32 lines
793 B
Ada
32 lines
793 B
Ada
with Ada.Text_IO; use Ada.Text_IO;
|
|
procedure Tasking is
|
|
protected Counter is
|
|
procedure Bump;
|
|
function Value return Natural;
|
|
private
|
|
N : Natural := 0;
|
|
end Counter;
|
|
protected body Counter is
|
|
procedure Bump is begin N := N + 1; end Bump;
|
|
function Value return Natural is begin return N; end Value;
|
|
end Counter;
|
|
|
|
task type Worker (Id : Positive);
|
|
task body Worker is
|
|
pragma Unreferenced (Id);
|
|
begin
|
|
for I in 1 .. 10_000 loop
|
|
Counter.Bump;
|
|
end loop;
|
|
end Worker;
|
|
begin
|
|
declare
|
|
T1 : Worker (1);
|
|
T2 : Worker (2);
|
|
T3 : Worker (3);
|
|
begin
|
|
null;
|
|
end; -- qui le tre task sono terminate
|
|
Put_Line ("incrementi totali:" & Natural'Image (Counter.Value) & " (attesi 30000)");
|
|
end Tasking;
|