comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: right compilation unit for C as main?
Date: Wed, 19 Dec 2012 10:00:33 +0200
Date: 2012-12-19T10:00:33+02:00	[thread overview]
Message-ID: <ajdah2FgiuvU1@mid.individual.net> (raw)
In-Reply-To: <lypq26yc7s.fsf@pushface.org>

On 12-12-19 05:04 , Simon Wright wrote:
> Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> 
>> Tasks can also be created during library-package elaboration,
>> which is called from adainit.
> 
> This is one of the few ways I've managed to cause elaboration-order
> problems with GNAT's default elaboration order algorithm.

That happened to me, too. I got around the problems by putting all
library-level tasks in packages that have no public (provided)
interface, so that these packages can be elaborated last. I usually
"with" these "task packages" only from the main subprogram.

Separating the tasks in this way also helps unit and integration
testing, because one can then build the program with any desired subset
of the tasks just by changing the "with" clauses in the main subprogram.

The converse drawback is that the absence or presence of tasks in some
subsystem is revealed at the highest design levels, instead of being
nicely hidden and encapsulated in the subsystem. Another result of this
design style is that it becomes difficult to use task entries and
rendez-vous, because of the rule that allows accept statements only in
the body of a task and not in subprograms called from the task. So I
tend to use only protected object entries.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .



  reply	other threads:[~2012-12-19  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18 15:02 right compilation unit for C as main? Patrick
2012-12-18 15:28 ` Brian Drummond
2012-12-18 15:42   ` Patrick
2012-12-18 17:13   ` Robert A Duff
2012-12-18 23:04     ` Brian Drummond
2012-12-19  3:04     ` Simon Wright
2012-12-19  8:00       ` Niklas Holsti [this message]
2012-12-19 16:31       ` Robert A Duff
2012-12-18 17:14 ` Robert A Duff
replies disabled

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