[rtems-libbsd commit] Added rtems specific version of _pthread_main_np()
Joel Sherrill
joel.sherrill at OARcorp.com
Fri Oct 5 17:14:08 UTC 2012
On 10/5/2012 12:03 PM, Ralf Corsepius wrote:
> 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.
Agreed. This was copied from the FreeBSD code.
> 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.
Jennifer.. add it to freebsd-userspace/.../pthread_np.h.
It should be "int pthread_main_np(void)". The FreeBSD libc code uses _ to
prefix symbols and there are macros to facilitate switching between
threaded and
non-threaded libc versions.
You may have to add this to the set of symbols in namespace.h to handle
the _
prefix being used internally.
> Ralf
>
>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel
--
Joel Sherrill, Ph.D. Director of Research& Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the devel
mailing list