Re: Fw: Some questions on reentrancy, __DYNAMIC_REENT__ and _impure_ptr

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCVpCBvoWayD0v9MotJeDzO+EDzFiSdGD0+u0v+vS8zRrQ@mail.gmail.com>
On Fri, Apr 2, 2021 at 1:35 PM Dave Nadler <[email protected]> wrote:

> Sorry if I was not clear: If you use one memory location for _impure_ptr,
> and you have two processors running two threads, this does not work.
> Instead an alternate mechanism (ie thread-local storage for this ptr) is
> needed,
> to support each concurrent thread with a separate reentrancy structure.
> Hope I was clear this time!
>

I understood it before but RTEMS has SMP support and we dealt with
this issue a few years ago so I had background. You want to make sure
the _impure_ptr is "thread local" whatever that means in the OS
adaptation. And you should be careful to implement the locking support
used in some parts of newlib.

--joel


> Thanks,
> Best Regards, Dve
>
> On 4/2/2021 12:51 PM, C Howland via Newlib wrote:
> >> ------------------------------
> >> *From:* Newlib <[email protected]> on behalf of Dave
> Nadler <
> >> [email protected]>
> >> *Sent:* Friday, April 2, 2021 7:34 AM
> >> *To:* Nick <[email protected]>
> >> *Cc:* [email protected] <[email protected]>
> >> *Subject:* Re: Some questions on reentrancy, __DYNAMIC_REENT__ and
> >> _impure_ptr
> >>
> >>
> >> Thanks Jeff also for answering the mutex question I missed.
> >> One other issue I should have mentioned that becomes more important
> daily:
> >> If there are multiple processors the simple _impure_ptr mechanism won't
> >> work...
> >>
> > Well, if you ignore the fact you have multiple processors and do nothing
> > about it, then, sure, you'll have problems.  But if you manage it (e.g.
> > treating each processor as its own thread, or as independent of each
> other,
> > etc.), then multiple processors can work fine.  (I have such systems
> > working.)
> > Craig
>
>
> --
> Dave Nadler, USA East Coast voice (978) 263-0097, [email protected], Skype
>   Dave.Nadler1
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.