From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Asynchronous channels in Ada
Date: Mon, 22 Feb 2016 09:48:49 +0100
Date: 2016-02-22T09:48:49+01:00 [thread overview]
Message-ID: <naei24$1cbp$1@gioia.aioe.org> (raw)
In-Reply-To: c850cac4-40d4-40c3-a850-4508e85f6460@googlegroups.com
On 21/02/2016 23:57, Hadrien Grasland wrote:
> Now, something goes wrong on the producer side, for any reason, which
> prevents this task from correctly producing its next data packet.
That cannot happen. You should reconsider your design if you really
think it could. When the communication channel is up the producer must
function.
I do not consider the case of a bug in the producer code. But anything
else is just a valid state. That includes all handled exceptions on the
producer side.
And any valid producer state must have a corresponding valid state on
the subscriber's side. This is just basics of any communication protocol
design.
> Transmit a specially crafted data packet representing an error (i.e. an exception).
This is not an "error" it is a valid state.
There is no problem to marshal an exception to the subscriber side. You
make the data object like this:
type Data (Abnormal : Boolean := False) is record
case Abnormal is
when True =>
Reason : Ada.Exceptions.Exception_ID;
when False =>
... -- Normal data
end case;
end record;
Remove default value for Abnormal if your FIFO can handle indefinite
objects. However, assuming that abnormal data objects are not frequently
to transmit, making them indefinite might be not necessary.
Regarding bugs, the safest way to handle a bug is to kill the
application as early as possible. It makes debugging easier.
> I wonder if I could find a way to build such a communication channel
> and reuse existing FIFO implementations without incurring twice the
> synchronization overhead. Most likely I should look into unsynchronized
> FIFO implementations then.
I think any implementation would go.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2016-02-22 8:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 21:02 Asynchronous channels in Ada Hadrien Grasland
2016-02-19 21:45 ` Simon Wright
2016-02-19 23:31 ` Robert A Duff
2016-02-19 21:51 ` Jeffrey R. Carter
2016-02-19 23:53 ` Brad Moore
2016-02-20 9:54 ` Dmitry A. Kazakov
2016-02-21 22:57 ` Hadrien Grasland
2016-02-22 2:30 ` Jeffrey R. Carter
2016-02-22 8:48 ` Dmitry A. Kazakov [this message]
2016-02-22 9:28 ` Georg Bauhaus
2016-02-25 7:55 ` Hadrien Grasland
2016-03-24 2:37 ` rieachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox