Newlib thread features.
Mon Sep 17 12:32:00 GMT 2001
J. Johnston wrote:
> Fabrice Gautier wrote:
>> Hi again,
>> Does anybody has an answer for my question ?
>> Fabrice Gautier wrote:
>>> I would like to know if Newlib has thread support and/or if it is thread
>>> It would like for use with uClinux.
>> Thank you.
>> Fabrice Gautier
> Newlib is not fully thread-safe. It has special versions of routines that can be
> used to create a thread-safe program. These are the _r routines which take an additional
> parameter which is the reentrancy structure for that thread. A program must create
> a separate reentrancy structure per thread.
> One unprotected area is I/O. A program must take responsibility for protecting all
> access to files. In the case of storage allocation and environment variables, special
> mutex calls are made but the code for the mutex locks is generally not provided for
> most platforms. If you code these routines, then the two areas are subsequently protected.
I don't know if uCLinux does this but RTEMS also provides a per-thread
copy of the reentrancy structure and
switches newlib's pointer (impure_ptr) during context switches. This
covers a bit more of the code.
> -- Jeff J.
Joel Sherrill, Ph.D. Director of Research & Development
joel@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the Newlib