a question about libc reentrancy

shizheng neversetsun at ustc.edu
Mon Jun 4 07:09:03 UTC 2007


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)?

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);
}




More information about the users mailing list