comp.lang.ada
 help / color / mirror / Atom feed
* array for all tasks
@ 2003-12-20 12:00 Ratson Janiv
  2003-12-20 14:37 ` Martin Dowie
  2003-12-22  9:45 ` Martin Krischik
  0 siblings, 2 replies; 3+ messages in thread
From: Ratson Janiv @ 2003-12-20 12:00 UTC (permalink / raw)


Hi,
I have a task with 3entries.
The first entry set an array size:
accept Start(Array_Size:Natural);
declare

Arr_Checks : Arr2(1..Array_Size);

begin ...

The other 2 tasks need to use this array.
how do I implement that, so the other tasks will also know and may use the
array?
10x?





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

* Re: array for all tasks
  2003-12-20 12:00 array for all tasks Ratson Janiv
@ 2003-12-20 14:37 ` Martin Dowie
  2003-12-22  9:45 ` Martin Krischik
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Dowie @ 2003-12-20 14:37 UTC (permalink / raw)


"Ratson Janiv" <janiv@013.net.il> wrote in message
news:3fe43a4c$1@news.barak.net.il...
> Hi,
> I have a task with 3entries.
> The first entry set an array size:
> accept Start(Array_Size:Natural);
> declare
>
> Arr_Checks : Arr2(1..Array_Size);
>
> begin ...
>
> The other 2 tasks need to use this array.
> how do I implement that, so the other tasks will also know and may use the
> array?
> 10x?

Sounds like you need a protected type/object rather than a task to ensure
data protection. Using a task for this sort of thing (while possible, as per
Ada83) is inefficient.





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

* Re: array for all tasks
  2003-12-20 12:00 array for all tasks Ratson Janiv
  2003-12-20 14:37 ` Martin Dowie
@ 2003-12-22  9:45 ` Martin Krischik
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Krischik @ 2003-12-22  9:45 UTC (permalink / raw)


Ratson Janiv wrote:

> Hi,

> I have a task with 3entries.
> The first entry set an array size:
> accept Start(Array_Size:Natural);
> declare
> 
> Arr_Checks : Arr2(1..Array_Size);
> 
> begin ...
> 
> The other 2 tasks need to use this array.
> how do I implement that, so the other tasks will also know and may use the
> array?

Arr_Checks'Length
Arr_Checks'First
Arr_Checks'Last

But do read about protected object before continuing. As other posters
pointed out protected objects might be better. I certanly would use a
protected object. You might also look at how I have solved a similar
problem:

http://adacl.sourceforge.net/html
______Include__AdaCL-Queue-Protect__adb.htm
http://adacl.sourceforge.net/html/______Include__AdaCL-Queue-Tasked__adb.htm

With Regards

Martin
-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




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

end of thread, other threads:[~2003-12-22  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-20 12:00 array for all tasks Ratson Janiv
2003-12-20 14:37 ` Martin Dowie
2003-12-22  9:45 ` Martin Krischik

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