[PATCH] c-user: Document global construction

Joel Sherrill joel at rtems.org
Wed Nov 22 21:39:48 UTC 2017


On Wed, Nov 22, 2017 at 3:31 PM, Chris Johns <chrisj at rtems.org> wrote:

> On 22/11/2017 23:42, Sebastian Huber wrote:
> > +Global Construction
> > +-------------------
> > +
> > +The global construction is carried out by the first Classic API
> initialization
> > +task.  If no Classic API initialization task exists, then it is carried
> out by
> > +the first POSIX API initialization thread.  If no initialization task
> or thread
> > +exists, then no global construction is performed, see for example
> > +:ref:`Specify Idle Task Performs Application Initialization`.
>
> What sort of context do the constructors run in?
>

They run in the context of the first user thread that runs. This means that
technically
it varies based on user initialization task/thread configuration.


>
> What impact does the context have on the configuration of what ever
> context is
> being used, eg stack size, priority, ...?
>

They use stack space. So they would have to be accounted for in the usage of
the thread they will run in. Which leads to the next issue... priority and
which
init thread runs them is a bit challenging

I think if you constructed an example with like both_hello and gave the
Classic API
initialization task a lower priority than the POSIX Initialization thread,
that you would
see the constructors run from the POSIX Initialization thread since it
would run
first.

isn't the rule that these are executed by the first thread to execute?


>
> What services in RTEMS can be used from global constructors?
>

Likely everything except services explicitly started like networking,
mounted
filesystems, etc.

There is also the issue that these could perform blocking operations and
that
could potentially lead to some weird situations. If you only have one
initialization
task/thread, it would introduce a possibly unexpected delay in the time
until
the application is really alive.

If the constructors create threads/tasks, there are scenarios where they
could
execute before the entire set of constructors is completed. That could lead
to
unfortunate situations.

All of this needs to be documented. My response is simply based on my
understanding of where in the initialization sequence these are executed
and what I think could occur.

--joel


>
> Chris
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20171122/463a7521/attachment-0002.html>


More information about the devel mailing list