comp.lang.ada
 help / color / mirror / Atom feed
From: nuchat!shell!spjerint!jon@uunet.uu.net
Subject: Re: HELP! HELP!  Dynamic InterTask Communication between different Pac
Date: 15 Nov 91 17:19:02 GMT	[thread overview]
Message-ID: <1991Nov15.171902.1813@shell.shell.com> (raw)

>I need to get two tasks in two different packages to communicat with each othe
r
>the problem is that it looks like it is impossible for both tasks to know abou
t
>each other unless they are in the same package.  In C I would just make up a 
>header file with forward references to both tasks just to define what they wer
e.

Well, in Ada, you do the same thing.  Only with package specs instead of
header files.

>I know this is possible in Ada, but so far, no luck.  What is wrong with my
>approach (example code follows).  Thanks in advance for any help.
>.

In one file, put this stuff
>package t is
>    task type taskt is
>	entry callt;
>    end taskt;
>end package t;

in another, put this guy, with the added lines
with p;
use p;
>package body t is
>    task type taskt is
>    begin
>       accept callt;
>       taskp.callp;
>    end taskt;
>end t;
> .

File 3 is this
>package p is
>    task type taskp is
>	entry callp;
>    end taskp;
>end package p;

File 4 is this, with added lines
with t;
use t;
>package body p is
>    task type taskp is
>    begin
>       accept callp;
>       taskt.callt;
>    end taskp;
>end p;

Then, compile the two specs first, then the two bodies.  Should
work fine.  I take it you've really got something more interesting
going on than your example shows.  Otherwise, this code doesn't 
go anywhere, since both tasks are waiting on a call from the other 
one.

Jon Holdman, jon@shell.com

             reply	other threads:[~1991-11-15 17:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-11-15 17:19 nuchat!shell!spjerint!jon [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-11-14  3:13 HELP! HELP! Dynamic InterTask Communication between different Pac Michael Feldman
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox