a question about libc reentrancy

Joel Sherrill joel.sherrill at oarcorp.com
Mon Jun 4 13:46:01 UTC 2007


shizheng wrote:
> Hi,all:
>
> I find that task extension hooks must be created for those tasks who
> need reentrancy.
> But the extension created by libc doesn't have libc_switch_hook any more as
> rtems-4.0.0(a very old version,huh:) ). So does it mean we should do it
> nearly in
> all my tasks(as u know reentrancy is so important)?
>
>   
The code got moved to cpukit/score/src/threaddispatch.c for performance 
reasons.

    if ( _Thread_libc_reent ) {
      executing->libc_reent = *_Thread_libc_reent;
      *_Thread_libc_reent = heir->libc_reent;
    }

--joel

> Here is the comment of libc_init.
>
> /*
>  *  Init libc for CYGNUS newlib
>  * 
>  *  Set up _REENT to use our global libc_global_reent.
>  *  (newlib provides a global of its own, but we prefer our own name for it)
>  *
>  *  If reentrancy is desired (which it should be), then
>  *  we install the task extension hooks to maintain the
>  *  newlib reentrancy global variable _REENT on task
>  *  create, delete, switch, exit, etc.
>  *
>  */
>
> void
> libc_init(int reentrant)
> {
>   _REENT = &libc_global_reent;
>
>   _Thread_Set_libc_reent (&_REENT);
> }
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>   




More information about the users mailing list