comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved94@home.com>
Subject: Re: How can I avoid Using a Semaphore?
Date: Sat, 20 Jan 2001 18:16:28 GMT
Date: 2001-01-20T18:16:28+00:00	[thread overview]
Message-ID: <0Cka6.290338$U46.9207275@news1.sttls1.wa.home.com> (raw)
In-Reply-To: 94563n$cb6kp$1@ID-25716.news.dfncis.de

"Nick Roberts" <nickroberts@callnetuk.com> wrote in message
news:94563n$cb6kp$1@ID-25716.news.dfncis.de...
> Steve, what you're doing IS dynamic run-time allocation! The only
difference
> is that you are doing it yourself, rather than getting Ada (or its runtime
> system) to do it for you.
>
> In this case, the problem of buffer allocation is 'orthogonal' to the
> problem of the synchronisation of tasks in passing data to one another
> through a buffer queue (perhaps 'pool' would be a better name then
'queue').
>

If I the data was only being referenced by one task at a time, I would
agree.  But to expand a little on my example, we have code that does
something like:

  packet := NewPacketNPU( 10000 );
  PutNPU( packet, value1 );
  PutNPU( packet, value2 );
  SendPacketTGM( port1, packet );
  SendPacketTGM( port2, packet );
  SendPacketTGM( port3, packet );

In this arrangement the packet is sent to three separate tasks, and may only
be released when all three are no longer referencing the data.

The reason I chose not to use Ada serialization, is that items are inserted
into the packet in "network byte order".  Unfortunately in Ada 95 the 'input
and 'output attributes are pre-defined for the built in data types, so I
have no control over byte ordering.  I know that GNAT works around this when
you use their DSA, but they do so by using a "special" version of the RTL
that makes ALL streams in network byte order.

In my opinion this is one of the weak points of Ada 95.  It would have been
better to not have the 'input and 'output pre-defined for built in types (as
a part of the language) but to include a package for defining these
attributes.  That way an arbitrary representation of built in types could be
used with streams when desired.

SteveD












  reply	other threads:[~2001-01-20 18:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-13 16:18 How can I avoid Using a Semaphore? (long) DuckE
2001-01-15  1:06 ` How can I avoid Using a Semaphore? Nick Roberts
2001-01-15  3:17   ` Robert Dewar
2001-01-16  3:53   ` DuckE
2001-01-17 15:42     ` Nick Roberts
2001-01-20 18:16       ` DuckE [this message]
2001-01-20 19:16         ` Robert Dewar
2001-01-21  1:28           ` DuckE
2001-01-21 16:04             ` Robert Dewar
2001-01-21 23:23               ` DuckE
2001-01-22  0:28                 ` mark_lundquist
2001-01-22  1:51                 ` Robert Dewar
2001-01-23  2:36                   ` DuckE
2001-01-22  0:35               ` Built-in types (was " mark_lundquist
2001-01-22  1:54                 ` Robert Dewar
2001-01-22 16:18                   ` mark_lundquist
2001-01-22 17:20                     ` Robert Dewar
2001-01-22 23:17                       ` Mark Lundquist
     [not found]                         ` <m33deaaeks.fsf@ns40.infomatch.bc.ca>
2001-02-02 22:01                           ` Mark Lundquist
     [not found]                         ` <94km00$bv8$1@nnrp1.deja.com>
2001-02-02 22:03                           ` Mark Lundquist
2001-01-21 16:53           ` Nick Roberts
2001-01-21 18:24             ` Robert Dewar
2001-01-23  0:21               ` Nick Roberts
2001-01-22  0:16         ` mark_lundquist
2001-01-22 16:51 ` How can I avoid Using a Semaphore? (long) mark_lundquist
2001-01-23  6:02   ` DuckE
2001-02-02 22:00     ` Sucking (was Re: How can I avoid Using a Semaphore? (long)) Mark Lundquist
2001-02-03  1:44       ` Jeffrey Carter
2001-02-03  3:21       ` DuckE
2001-02-05 20:07         ` Mark Lundquist
2001-02-06  7:16           ` Sven Nilsson
2001-02-02 22:18     ` How can I avoid Using a Semaphore? (long) Mark Lundquist
2001-02-03  3:01       ` DuckE
2001-02-02 21:38 ` Niklas Holsti
replies disabled

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