comp.lang.ada
 help / color / mirror / Atom feed
From: "Mark Lundquist" <mark@rational.com>
Subject: Re: (Newbie) intertask communication
Date: Fri, 06 Apr 2001 20:46:04 GMT
Date: 2001-04-06T20:46:04+00:00	[thread overview]
Message-ID: <gWpz6.683709$U46.21252883@news1.sttls1.wa.home.com> (raw)
In-Reply-To: q9nz6.15400$ii5.1263786@afrodite.telenet-ops.be


Pieter Thysebaert <pieter.thysebaert@pandora.be> wrote in message
news:q9nz6.15400$ii5.1263786@afrodite.telenet-ops.be...
> Hi....
>
> I'm trying to have two tasks interact (using entry/accept).
> In fact we have this assignment where we are supposed to (not in reality)
> monitor some patient's heartbeat.
>
>
[example snipped...]

OK, this post was a prime example of the right way to ask for help with a
homework assignment!  Thanks, Pieter!

> How would I pass the "name" of a task to antoher task to have it use that
> one ?
> And how can I save a "reference"to a task  ?

Use an access type designating a task type.  This can be used for any formal
parameter (to a "callable entity", i.e. subprogram or entry, or to a
generic), and of course you can declare a variable of this type in your
Patient task and assign to it, to save your reference to the other task.  So
for example:

    task type Monitor is
        .
        .

    type Access_Monitor is access all Monitor;
    .
    .

    Monitor_1 : aliased Monitor;

    Patient_1.Start  (Monitor_1'Access);


Also, a task type can have discriminants.  So you can do this:

    task type Patient (Associated_Monitor : Access_Monitor)

For that matter, it can be an "access discriminant" (then you no longer need
the access type, and you get a built-in null check):

    task type Patient (Associated_Monitor : access Monitor);

Hope this helps,
-- mark






      reply	other threads:[~2001-04-06 20:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-06 17:37 (Newbie) intertask communication Pieter Thysebaert
2001-04-06 20:46 ` Mark Lundquist [this message]
replies disabled

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