This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Reentrancy support for multiprocessor systems
- From: "Likely, Grant" <Grant dot Likely at gdcanada dot com>
- To: "'newlib at sources dot redhat dot com'" <newlib at sources dot redhat dot com>
- Date: Tue, 18 Mar 2003 09:38:16 -0700
- Subject: Reentrancy support for multiprocessor systems
I'm working on a SMP PowerPC board that has 2 8260s on the same address bus.
The application I'm writing has no OS, so it simply has a seperate thread of
execution running on each of the processors.
The question that I have is with regard to the concurrent support for
reentrancy. As far as I understand, newlib is fully reentrant providing
that each process has a seperate reentrancy structure, and the pointer to
that structure is stored in _impure_ptr. The problem lies in the fact that
because the processors are executing concurrently and they share an
identical address space, I need to choose a value for _impure_ptr based on
the processor the code is executing on. I cannot use the reentrant versions
of the library functions because I'm using a pre-written application in my
threads that I cannot rewrite to use the _r functions.
Is it safe to modify the _impure_ptr pointer to be a macro that calls a
function and returns the correct pointer? (just like the errno macro?) Is
there a better way to do this?
Thanks,
g.