This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] enable dynamic (thread safe) reents


On Fri, Jun 13, 2003 at 08:20:47AM +0200, Thomas Pfaff wrote:
>Christopher Faylor wrote:
>>On Fri, May 16, 2003 at 02:12:16PM +0200, Thomas Pfaff wrote:
>>
>>>Thomas Pfaff wrote:
>>>
>>>
>>>>While single threaded apps should keep run without problems (_impure_ptr
>>>>is still used for the mainthread) multithreaded apps should be recompiled
>>>>to get the full power of the thread safe reents. This is due the
>>>>fact that _RRENT is used in some newlib headers directly. Unfortunately
>>>>this affects also static libs, therefore this is will be a longer
>>>>transition.
>>>>
>>>
>>>TTTT,
>>>
>>>this will only affect stdio
>>>
>>>stdio.h:147:#define     stdin   (_REENT->_stdin)
>>>stdio.h:148:#define     stdout  (_REENT->_stdout)
>>>stdio.h:149:#define     stderr  (_REENT->_stderr)
>>>
>>>and i consider this harmless.
>>
>>
>>Does this imply that using a DLL rebuilt like this will require 
>>recompilation
>>of static libraries using errno?
>>
>
>No. errno is handled differently.
>
>#ifndef _REENT_ONLY
>#define errno (*__errno())
>extern int *__errno _PARAMS ((void));
>#endif
>
>and __errno is in newlib implemented as
>
>int *
>__errno ()
>{
>  return &_REENT->_errno;
>}
>
>Therefore threads safe errnos are automatically enabled when newlib is 
>compiled with __DYNAMIC_REENT__.
>
>Unfortunately stdin, stdout and stderr were defined with _REENT 
>directly. Sigh.

Should we submit a patch to newlib which fixes this?

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]