__printf_lock and __printf_unlock

Comments

4 comments

  • Avatar
    Michael Johnson

    Set the "Use Multi Threaded Libraries" property to "Yes" - we need to rename this property.

    0
    Comment actions Permalink
  • Avatar
    Jerry Gardner

    When I set  "Use Multi Threaded Libraries" to "Yes", does that mean that I no longer need to implement __printf_lock and _unlock?

    When I set this property to "Yes" and define __printf_lock (and _unlock), they are discarded by the linker, presumably because nothing calls them.

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    If you don't use printf/scanf then they won't be required - assuming you leave "Enable Unused Symbol Removal" set to "Yes".

    0
    Comment actions Permalink
  • Avatar
    Jerry Gardner

    I only use sprintf in my code, not printf/scanf. Based on your reply above, it looks like I don't need to implement mutual exclusion--is this correct? Is sprintf thread-safe without having to implement any specific mechanisms (like __printf_lock/unlock)?

    This came up because I'm having problems with bus errors happening in the library vfprintf code. My application runs under an RTOS, so thread safety is an issue.

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.