comp.lang.ada
 help / color / mirror / Atom feed
* Tasks sharing a protected object
@ 2001-10-26 14:01 Martin Magnusson
  2001-10-26 14:49 ` Ted Dennison
  2001-10-26 15:20 ` Wes Groleau
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Magnusson @ 2001-10-26 14:01 UTC (permalink / raw)


I want to have two tasks sharing a protected object with data used by
both tasks. How do I make them see the same object? I have three
files defining the different types, skeletons for them are shown
below. How can I set the object to use when declaring the task types?

--------

package Agent is
   task type Agent_Task is
      ...
end Agent;

--------

package Environment is
   task type Environment_Task is
      ...
end Environment;

--------

package Shared_Data is
   protected type Shared_Data_Type is
      ...
end Shared_Data;



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tasks sharing a protected object
  2001-10-26 14:01 Tasks sharing a protected object Martin Magnusson
@ 2001-10-26 14:49 ` Ted Dennison
  2001-10-31  8:59   ` Tony Gair
  2001-10-26 15:20 ` Wes Groleau
  1 sibling, 1 reply; 5+ messages in thread
From: Ted Dennison @ 2001-10-26 14:49 UTC (permalink / raw)


In article <n6i669233gp.fsf@mink.it.uu.se>, Martin Magnusson says...
>
>I want to have two tasks sharing a protected object with data used by
>both tasks. How do I make them see the same object? I have three
>files defining the different types, skeletons for them are shown
>below. How can I set the object to use when declaring the task types?

Pretty simple. Either:

o  Put it in a package spec that both can "with", or 
o  Make them task *types* with the protected type as a discriminint, then pass
the proper object in when they are created, or
o  Make an "initialize" rendezvous for both tasks, and pass the protected object
in as a parameter.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html

No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tasks sharing a protected object
  2001-10-26 14:01 Tasks sharing a protected object Martin Magnusson
  2001-10-26 14:49 ` Ted Dennison
@ 2001-10-26 15:20 ` Wes Groleau
  1 sibling, 0 replies; 5+ messages in thread
From: Wes Groleau @ 2001-10-26 15:20 UTC (permalink / raw)




Martin Magnusson wrote:
> 
> I want to have two tasks sharing a protected object with data used by
> both tasks. How do I make them see the same object? I have three
> files defining the different types, skeletons for them are shown
> below. How can I set the object to use when declaring the task types?

Put them all in the same package--obviously they're related.

Or put the common stuff in one package and put the tasks
in child packages.

If you want the common stuff visible only to those tasks,
put it in a private child.

-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tasks sharing a protected object
  2001-10-26 14:49 ` Ted Dennison
@ 2001-10-31  8:59   ` Tony Gair
  2001-11-01 21:16     ` Ted Dennison
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Gair @ 2001-10-31  8:59 UTC (permalink / raw)


Are you sure ted that the protected object will work that way,
I thought the data storing package would have to be the parent of both tasks
sharing the data,

are you sure that two identical protected objects (with different data would
be created....

one sure way is two adasocket the storing task ala S.Tardeau



"Ted Dennison" <dennison@telepath.com> wrote in message
news:YJeC7.1486$xS6.2081@www.newsranger.com...
> In article <n6i669233gp.fsf@mink.it.uu.se>, Martin Magnusson says...
> >
> >I want to have two tasks sharing a protected object with data used by
> >both tasks. How do I make them see the same object? I have three
> >files defining the different types, skeletons for them are shown
> >below. How can I set the object to use when declaring the task types?
>
> Pretty simple. Either:
>
> o  Put it in a package spec that both can "with", or
> o  Make them task *types* with the protected type as a discriminint, then
pass
> the proper object in when they are created, or
> o  Make an "initialize" rendezvous for both tasks, and pass the protected
object
> in as a parameter.
>
> ---
> T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
>
> No trees were killed in the sending of this message.
> However a large number of electrons were terribly inconvenienced.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Tasks sharing a protected object
  2001-10-31  8:59   ` Tony Gair
@ 2001-11-01 21:16     ` Ted Dennison
  0 siblings, 0 replies; 5+ messages in thread
From: Ted Dennison @ 2001-11-01 21:16 UTC (permalink / raw)


In article <9rnime$5cc$1@neptunium.btinternet.com>, Tony Gair says...
>
>Are you sure ted that the protected object will work that way,
>I thought the data storing package would have to be the parent of both tasks
>sharing the data,
>
>are you sure that two identical protected objects (with different data would
>be created....

>"Ted Dennison" <dennison@telepath.com> wrote in message
>news:YJeC7.1486$xS6.2081@www.newsranger.com...
>> o  Make them task *types* with the protected type as a discriminint, then
>pass

A discriminant has to be a "discrete or access subtype". That means that you'd
really have to pass in a *pointer* to the protected object (I was sort of
glossing over that bit for simplicity). That means that they would indeed be the
same protected object, unless you purposely make it otherwise.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html

No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-11-01 21:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-26 14:01 Tasks sharing a protected object Martin Magnusson
2001-10-26 14:49 ` Ted Dennison
2001-10-31  8:59   ` Tony Gair
2001-11-01 21:16     ` Ted Dennison
2001-10-26 15:20 ` Wes Groleau

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