This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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: How to destroy _reent structure


On Apr 24 13:10, Sebastian Huber wrote:
> Hello Corinna,
> 
> On 04/24/2013 12:26 PM, Corinna Vinschen wrote:
> >On Apr 24 10:04, Sebastian Huber wrote:
> >>Hello,
> >>
> >>there is _REENT_INIT_PTR() for initialization, but how can I destroy
> >>a _reent structure.  Is this _wrapup_reent()?
> >
> >Try _reclaim_reent.  But it's not the same as _REENT_INIT_PTR since
> >_REENT_INIT_PTR does not allocate any memory.
> >
> >
> >Corinna
> >
> 
> so for initialization we can use:
> 
> struct _reent *p = malloc(sizeof(*p));
> if (p != NULL) {
>   _REENT_INIT_PTR(p);
> }
> 
> For destruction we can use:
> 
> _reclaim_reent(p);
> free(p);
> 
> What is the purpose of _wrapup_reent()?  Its not called from within
> Newlib and I don't find a function that can register an atexit
> handler in a non-global _reent structure.  There is also no public
> header file for this function.

Sorry, I can't answer this question.  This code predates my involvement
in newlib and I never looked deeper into this.  Cygwin also uses
_reclaim_reent to get rid of the per-pthread reent structure.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat


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