From: Randy Kosarik <randyk@access.hky.com>
Subject: returning a value from tasking??
Date: 1996/11/30
Date: 1996-11-30T00:00:00+00:00 [thread overview]
Message-ID: <32A080A9.7BCA@access.hky.com> (raw)
Hi,
I am having a problem getting a task to work and am running out of
time this semester.
I am running DEC Ada version 8.2 on a VAX.
What I am trying to do is get a character within 3 seconds, if no
character was
inputted, I want either a null character returned or a space returned. I
was told from
a previous message that I would have to TASK to do this.
I have TASK2 calling TASK1. TASK1 will not return a value to TASK2
unless I remove the
second to last line( DO_EXIT(STATUS); ) from TASK1. When I do this
though, it will not exit when 3 seconds have expired.
I have been scouring through the books trying to figure this one out
but, the tasking concept seems to be above my head, right now.. I keep
doing trial and error.
Please, I have 10 days to figure this out... Any replies would be
GREATLY appreciated!
-Randy
--------------------------start of
TASK2.ADA----------------------------------------
with text_io, task1;
use text_io;
procedure task2 is
z : character;
x : INTEGER;
begin
loop
task1(z => z);
put_line(z & " brought from task1");
exit when x > 5;
x := x + 1;
end loop;
end task2;
--------------------------end of
TASK2.ADA------------------------------------------
--------------------------start of
TASK1.ADA----------------------------------------
with TEXT_IO;
use TEXT_IO;
procedure task1 (z : in out CHARACTER) is
-- pragma TIME_SLICE (1.0);
type CONDITION is new INTEGER;
STATUS : CONDITION;
-- Z:CHARACTER;
task T;
task body T is
begin
Get(Z);
end;
procedure DO_EXIT(STATUS :out CONDITION;
EXIT_STATUS :in CONDITION := 1);
pragma INTERFACE(VMS, DO_EXIT);
pragma IMPORT_VALUED_PROCEDURE(DO_EXIT,
pragma IMPORT_VALUED_PROCEDURE(DO_EXIT,
"SYS$EXIT",
MECHANISM => (VALUE, VALUE));
begin
delay 3.0;
-- nothing done;
DO_EXIT(STATUS);
end task1;
--------------------------end of
TASK1.ADA-----------------------------------------
next reply other threads:[~1996-11-30 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-30 0:00 Randy Kosarik [this message]
1996-12-01 0:00 ` returning a value from tasking?? Robert Dewar
1996-12-01 0:00 ` Tom Moran
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox