Close #3243. --- c-user/fatal_error.rst | 5 ---- c-user/initialization.rst | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 5 deletions(-)
diff --git a/c-user/fatal_error.rst b/c-user/fatal_error.rst index 320227b..090850d 100644 --- a/c-user/fatal_error.rst +++ b/c-user/fatal_error.rst @@ -239,11 +239,6 @@ INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL (26) occur during system initialization. It is an application configuration error. -INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL (27) - A POSIX initialization thread entry function is NULL. This fatal error may - occur during system initialization. It is an application configuration - error. - INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK (28) A deadlock was detected during a thread queue enqueue operation. diff --git a/c-user/initialization.rst b/c-user/initialization.rst index 6c30a2d..935a61e 100644 --- a/c-user/initialization.rst +++ b/c-user/initialization.rst @@ -294,6 +294,66 @@ Many of RTEMS actions during initialization are based upon the contents of the Configuration Table. For more information regarding the format and contents of this table, please refer to the chapter :ref:`Configuring a System`. +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`. + +Global constructors are C++ global object constructors or functions with the +constructor attribute. For example, the following test program + +.. code-block:: c + + #include <stdio.h> + #include <assert.h> + + class A { + public: + A() + { + puts( "A:A()" ); + } + }; + + static A a; + + static thread_local int i; + + static thread_local int j; + + static __attribute__((__constructor__)) void b( void ) + { + i = 1; + puts( "b()" ); + } + + static __attribute__((__constructor__(1000))) void c( void ) + { + puts( "c()" ); + } + + int main(void) + { + assert(i == 1); + assert(j == 0); + return 0; + } + +should output: + +.. code-block:: shell + + c() + b() + A:A() + +Thread-local objects or POSIX key values created during global construction are +accessible by the corresponding initialization task or thread. + Directives ========== -- 2.12.3 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel