This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

latest C-library reentrancy status

In versions 4 and 5 of the C-library,
approximately half the routines were reentrant. What is the current status?
Will some functions ( such as the memory allocation routines ) never be reentrant?
[Note: I know I can bracket non-reentrant routines with a semaphore.]


Parents
  • If you just want to protect a library function like puts from reentrancy, you can create the following:

    void R_puts (unsigned char *p)
    {
    os_wait( K_MBX + SEM_PUTS, 255, 0 )
    puts(p);
    os_send_token(SEM_PUTS);
    }
    Then, in your program, call R_puts instead of puts:
    void func (void)
    {
    R_puts("This is great.");
    R_puts("This is great, 2.");
    R_puts("This is great, 3.");
    }
    This is just one of the ways you can hide the semaphore operations.

    Jon

Reply
  • If you just want to protect a library function like puts from reentrancy, you can create the following:

    void R_puts (unsigned char *p)
    {
    os_wait( K_MBX + SEM_PUTS, 255, 0 )
    puts(p);
    os_send_token(SEM_PUTS);
    }
    Then, in your program, call R_puts instead of puts:
    void func (void)
    {
    R_puts("This is great.");
    R_puts("This is great, 2.");
    R_puts("This is great, 3.");
    }
    This is just one of the ways you can hide the semaphore operations.

    Jon

Children
No data