From: tancheeh@fred.cs.washington.edu (Nicholas Tan Chee Hiang)
Subject: shared variable between tasks
Date: 29 Jun 89 02:07:58 GMT [thread overview]
Message-ID: <8610@june.cs.washington.edu> (raw)
I am trying to understand concurrency in Ada. Can someone please tell
me why the variable Unprotected below is never updated? Thanks!
- N
------------------------------>code below<------------------------------
with Text_IO; use Text_IO;
procedure Unprotected_Shared_Variable is
Unprotected : Character := '*';
pragma SHARED(Unprotected);
task Write_Letter_A_To_Variable;
task Access_Variable;
task body Write_Letter_A_To_Variable is
Letter : constant Character := 'A';
begin
loop
Unprotected := Letter;
delay 0.5;
end loop;
end Write_Letter_A_To_Variable;
task body Access_Variable is
Letter : Character := Unprotected;
begin
loop
Put (Letter);
delay 3.0;
end loop;
end Access_Variable;
begin
null;
end Unprotected_Shared_Variable;
next reply other threads:[~1989-06-29 2:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1989-06-29 2:07 Nicholas Tan Chee Hiang [this message]
1989-06-29 12:12 ` shared variable between tasks Mark D. Guzzi
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox