libc_wrapup() and _Thread_Dispatch()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Apr 23 14:39:13 UTC 2013


On 04/23/2013 04:35 PM, Joel Sherrill wrote:
>> In _Thread_Dispatch():
>>
>>       /*
>>        * Switch libc's task specific data.
>>        */
>>       if ( _Thread_libc_reent ) {
>>         executing->libc_reent = *_Thread_libc_reent;
>>         *_Thread_libc_reent = heir->libc_reent;
>>       }
>>
>> What is the reason for the "executing->libc_reent = *_Thread_libc_reent;"
>> assignment.  I think this is a bug since it destroys the value created by
>> newlib_create_hook() for the initialization task.  From my point of view are
>> the newlib hooks the only entities that should touch thread->libc_reent.
>>
>
> When you posted your first email, I looked at _Thread_libc_reent and wondered
> why it existed. Are you able to get rid of it?
>
> The code is in _Thread_Dispatch() for efficiency. But using a global variable is
> questionable. Even the comment on _Thread_libc_reent hints that the
> variable is suspect to me.

I think this variable exists to have no direct reference to the _impure_ptr or 
_global_impure_ptr.  It is referenced via newlib_create_hook().

I want to perform some cleanup with the existing Newlib and then switch to the 
__getreent() based version.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list