This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
The thread model in newlib
- From: "Leif Ekblad" <leif at rdos dot net>
- To: <newlib at sources dot redhat dot com>
- Date: Fri, 16 Dec 2005 18:47:13 +0100
- Subject: The thread model in newlib
- References: <7f45d9390512150911p70c20e6fu@mail.gmail.com>
I'm trying to use GCC + newlib for my OS (RDOS, http://www.rdos.net/rdos). I
did try to
do a port 2002, but as I've studied my sources it turns out the patches for
thread / reentrance
support were quite ugly.
RDOS only runs on i386, so portability is not a concern. I already have a
working environment
with BCC 4.52 + TD32, which works since a couple of years ago. However, I
like the open
environment better, and Borland no longer develops this compiler. With
PE-executables, the
thread issue has a rather elegant solution for i386. You simply load a
segment register (FS in
the case of PE), and let each thread have it's own selector. This way it is
easy to implement
TLS and provide each thread with it's own data. It doesn't seem like it is
easy to implement
this in newlib, at least not in version 1.10. I would rather only implement
the non _r function-calls.
There is no need to provide an extra parameter, especially since every
function call in RDOS
is reentrant. However, it is essential that the run-time library also is
reentrant.
Any suggestions?
Regards,
Leif Ekblad