[rtems-libbsd commit] Added rtems specific version of _pthread_main_np()

Ralf Corsepius ralf.corsepius at rtems.org
Fri Oct 5 17:03:01 UTC 2012

On 10/05/2012 04:31 PM, Jennifer Averett wrote:
> Module:    rtems-libbsd
> Branch:    master
> Commit:    45a81cdc5e8c9ed35a8aa706e0ea360d357a574b
> Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=45a81cdc5e8c9ed35a8aa706e0ea360d357a574b
> Author:    Jennifer Averett <jennifer.averett at oarcorp.com>
> Date:      Fri Oct  5 09:34:09 2012 -0500
> Added rtems specific version of _pthread_main_np()
> This required adding rtems_id rtems_init_task_id to identify the
> main task.

Two remarks:

> +/*
> + * Provide the equivalent to Solaris thr_main() function
> + */
a) Why should RTEMS care about Solaris' thr_main()?

Solaris threads are dead for decades and nobody with a sane mind will 
use them. The rationale for adding this escapes me.

> +int
> +_pthread_main_np()
> +{
> +  /* Created and set in rtems_bsd_initialize */
> +  extern rtems_id rtems_init_task_id;

This is a nested extern. It's something, many people consider _really_ 
bad design, because it renders code unreliable and error-prone.

Personally I have been fighting such nested externs as long as I had 
been involved into RTEMS.

Please consider using a private global definition or even a static 
variable instead.


More information about the devel mailing list